Skip to content

Commit

Permalink
Add flake8 static style checker
Browse files Browse the repository at this point in the history
  • Loading branch information
BasicWolf committed Oct 24, 2024
1 parent 02d5fa0 commit d7ba7c2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ all:
@echo ' make docs generate documentation'


build: mypy test docs
build: flake8 mypy test docs

flake8:
flake8 src/

mypy:
MYPYPATH=src mypy -p sphinx_testify -p test
Expand Down
1 change: 1 addition & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
flake8==7.1.1
mypy==1.13.0
pytest==8.3.3
sphinx==8.1.3
Expand Down
11 changes: 7 additions & 4 deletions src/sphinx_testify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def setup(app: Sphinx) -> ExtensionMetadata:
default=[],
rebuild='env',
types=[list[str]],
description="""List of testing result files paths. The results should be in JUnit XML format"""
description=("List of testing result files paths."
" The results should be in JUnit XML format""")
)
app.add_directive('testify', TestifyDirective)
app.add_event('testify-testified')
Expand All @@ -48,8 +49,8 @@ def setup(app: Sphinx) -> ExtensionMetadata:


def _on_builder_inited(app: Sphinx):
env = app.env
setattr(env, 'testify_test_names', _parse_tests_results_xml(app.config.testify_from))
test_results = _parse_tests_results_xml(app.config.testify_from)
setattr(app.env, 'testify_test_names', test_results)


def _parse_tests_results_xml(testify_from: list[str]) -> list[str]:
Expand All @@ -64,5 +65,7 @@ def _parse_tests_results_xml(testify_from: list[str]) -> list[str]:
for testcase_elem in testsuite_elem.iter('testcase'):
test_class_name = testcase_elem.get('classname')
test_name = testcase_elem.get('name')
test_names.append(f'{testsuite_name}.{test_class_name}.{test_name}')
test_names.append(
f'{testsuite_name}.{test_class_name}.{test_name}'
)
return test_names
2 changes: 1 addition & 1 deletion src/test/test_sphinx_testify.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_testify_single_passed_test_case(app: SphinxTestApp):

def _on_testified(_app, test_name: str):
nonlocal testified_only_registered_users_have_access
if test_name == 'testsuite.testclass.test_only_registered_users_have_access':
if test_name == 'testsuite.testclass.test_only_registered_users_have_access': # noqa E501 - line too long
testified_only_registered_users_have_access = True
app.connect('testify-testified', _on_testified)

Expand Down

0 comments on commit d7ba7c2

Please sign in to comment.