mirror of
https://github.com/godotengine/buildroot.git
synced 2026-01-05 14:09:53 +03:00
Makefile: merge check-flake8 into check-package
Teach check-package to detect python files by type and check them using flake8. Do not use subprocess to call 'python3 -m flake8' in order to avoid too many spawned shells, which in its turn would slow down the check for multiple files. (make check-package takes twice the time using a shell for each flake8 call, when compared of importing the main application) Expand the runtime test and the unit tests for check-package. Remove check-flake8 from the makefile and also from the GitLab CI because the exact same checks become part of check-package. Suggested-by: Arnout Vandecappelle <arnout@mind.be> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> [Arnout: add a comment to x-python to explain its purpose] Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
committed by
Arnout Vandecappelle
parent
60fdaf56fe
commit
9df6503ed0
@@ -13,10 +13,6 @@ before_script:
|
||||
script:
|
||||
- utils/get-developers -v
|
||||
|
||||
.check-flake8_base:
|
||||
script:
|
||||
- make check-flake8
|
||||
|
||||
.check-package_base:
|
||||
script:
|
||||
- make check-package
|
||||
|
||||
@@ -26,7 +26,7 @@ gen_tests() {
|
||||
local do_basics do_defconfigs do_runtime do_testpkg
|
||||
local defconfigs_ext cfg tst
|
||||
|
||||
basics=( check-package check-symbol DEVELOPERS flake8 package symbol )
|
||||
basics=( check-package check-symbol DEVELOPERS package symbol )
|
||||
|
||||
defconfigs=( $(cd configs; LC_ALL=C ls -1 *_defconfig) )
|
||||
|
||||
|
||||
3
support/testing/tests/utils/br2-external/utils/x-python
Normal file
3
support/testing/tests/utils/br2-external/utils/x-python
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
# Trigger flake8 warning "W391 blank line at end of file"
|
||||
|
||||
@@ -250,3 +250,20 @@ class TestCheckPackage(unittest.TestCase):
|
||||
self.assert_file_was_processed(m)
|
||||
self.assert_warnings_generated_for_file(m)
|
||||
self.assertIn("{}:0: run 'shellcheck' and fix the warnings".format(abs_file), w)
|
||||
|
||||
# python scripts are tested using flake8
|
||||
rel_file = "utils/x-python"
|
||||
abs_path = infra.filepath("tests/utils/br2-external")
|
||||
abs_file = os.path.join(abs_path, rel_file)
|
||||
|
||||
w, m = call_script(["check-package", "-vvv", "-b", rel_file],
|
||||
self.WITH_UTILS_IN_PATH, abs_path)
|
||||
self.assert_file_was_processed(m)
|
||||
self.assert_warnings_generated_for_file(m)
|
||||
self.assertIn("{}:0: run 'flake8' and fix the warnings".format(rel_file), w)
|
||||
|
||||
w, m = call_script(["check-package", "-b", abs_file],
|
||||
self.WITH_UTILS_IN_PATH, infra.basepath())
|
||||
self.assert_file_was_processed(m)
|
||||
self.assert_warnings_generated_for_file(m)
|
||||
self.assertIn("{}:0: run 'flake8' and fix the warnings".format(abs_file), w)
|
||||
|
||||
Reference in New Issue
Block a user