Skip to content

Commit aaeb707

Browse files
Robert Schützelprans
authored andcommitted
Check for .flake8 after importing flake8
This way, tests won't fail if both the flake8 module and the .flake8 file are missing.
1 parent e3ad12d commit aaeb707

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎tests/test__sourcecode.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ def find_root():
1717
classTestFlake8(unittest.TestCase):
1818

1919
deftest_flake8(self):
20-
root_path=find_root()
21-
config_path=os.path.join(root_path, '.flake8')
22-
ifnotos.path.exists(config_path):
23-
raiseRuntimeError('could not locate .flake8 file')
24-
2520
try:
2621
importflake8# NoQA
2722
exceptImportError:
2823
raiseunittest.SkipTest('flake8 module is missing')
2924

25+
root_path=find_root()
26+
config_path=os.path.join(root_path, '.flake8')
27+
ifnotos.path.exists(config_path):
28+
raiseRuntimeError('could not locate .flake8 file')
29+
3030
try:
3131
subprocess.run(
3232
[sys.executable, '-m', 'flake8', '--config', config_path],

0 commit comments

Comments
(0)