diff --git a/.flake8 b/.flake8 index 4d98d97..5808824 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,6 @@ [flake8] exclude = .git,__pycache__,build,dist,.tox -ignore = A003, C901, E203, E266, E501, W503,D100,D101,D102,D102,D103,D104,D105,D106,D107,D203,D403,D213,B028,B906,B907 +ignore = A003, C901, E203, E266, E501, W503,D100,D101,D102,D102,D103,D104,D105,D106,D107,D203,D403,D213,B028,B906,B907,E704 # line length is intentionally set to 80 here because black uses Bugbear # See https://github.com/psf/black/blob/master/README.md#line-length for more details max-line-length = 80 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c010ad5..5620775 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,27 +1,29 @@ repos: - - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + - repo: https://github.com/pycqa/flake8 + rev: 7.0.0 hooks: - - id: flake8 - additional_dependencies: - - flake8-bugbear - - flake8-builtins - - flake8-comprehensions - - flake8-docstrings - - flake8-rst-docstrings - - pygments - args: [--config=.flake8] + - id: flake8 + additional_dependencies: + - flake8-bugbear + - flake8-builtins + - flake8-comprehensions + - flake8-docstrings + - flake8-rst-docstrings + - pygments + args: + - --config=.flake8 - repo: https://github.com/ambv/black - rev: 23.1.0 + rev: 24.2.0 hooks: - - id: black - args: ["--line-length=79"] + - id: black + args: + - --line-length=79 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.1.1 + rev: v1.8.0 hooks: - - id: mypy - files: '\.py$' - exclude: '^(tests|doc)/.+$' - additional_dependencies: - - types-PyYAML - - types-setuptools + - id: mypy + files: \.py$ + exclude: ^(tests|doc)/.+$ + additional_dependencies: + - types-PyYAML + - types-setuptools \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index 9a3e07e..04d1273 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -16,6 +16,8 @@ # import sys # sys.path.insert(0, os.path.abspath('.')) +import os.path +import sys # -- Project information ----------------------------------------------------- @@ -178,8 +180,7 @@ # A list of files that should not be packed into the epub file. epub_exclude_files = ["search.html"] -import os.path -import sys + sys.path.insert(0, os.path.abspath("../src")) extensions += ["autoapi.extension"] autoapi_type = "python" diff --git a/src/e3/testsuite/__init__.py b/src/e3/testsuite/__init__.py index d5b78bf..2307e74 100644 --- a/src/e3/testsuite/__init__.py +++ b/src/e3/testsuite/__init__.py @@ -407,7 +407,7 @@ def testsuite_main(self, args: Optional[List[str]] = None) -> int: action="store_true", help="Run only tests that did not pass in the previous testsuite" " run. This attempts to find successful tests in the report stored" - " at the location where this run will create the testsuite report." + " at the location where this run will create the testsuite report.", ) parser.add_argument( "sublist", metavar="tests", nargs="*", default=[], help="test" @@ -543,7 +543,9 @@ def should_skip(pt: ParsedTest) -> bool: """ entry = self.old_report_index.entries.get(pt.test_name) return entry is not None and entry.status in ( - TestStatus.PASS, TestStatus.XFAIL, TestStatus.XPASS + TestStatus.PASS, + TestStatus.XFAIL, + TestStatus.XPASS, ) self.test_list = [ @@ -707,7 +709,7 @@ def helper(spec: str) -> None: # Don't descend into internal VCS directories, because it will # likely generate a lot of unnecessary I/O operations and we # don't expect to find any tests there anyway. - for vcsdir in ['.git', '.svn', 'CVS']: + for vcsdir in [".git", ".svn", "CVS"]: if vcsdir in dirnames: dirnames.remove(vcsdir) @@ -1113,10 +1115,10 @@ def collect_result(job: ProcessTestFragment) -> None: job.collect_result() self.collect_result(job) - scheduler: MultiprocessScheduler[ - FragmentData, ProcessTestFragment - ] = MultiprocessScheduler( - dag, job_factory, collect_result, jobs=self.main.args.jobs + scheduler: MultiprocessScheduler[FragmentData, ProcessTestFragment] = ( + MultiprocessScheduler( + dag, job_factory, collect_result, jobs=self.main.args.jobs + ) ) # See corresponding code/comment in run_multithread_mainloop diff --git a/src/e3/testsuite/_helpers.py b/src/e3/testsuite/_helpers.py index 6934439..f321dcb 100644 --- a/src/e3/testsuite/_helpers.py +++ b/src/e3/testsuite/_helpers.py @@ -1,6 +1,5 @@ """Internal helpers for e3.testsuite.""" - import warnings from typing import Any, Callable, List, TypeVar, cast diff --git a/src/e3/testsuite/fragment.py b/src/e3/testsuite/fragment.py index 4a5aa4c..471e7d9 100644 --- a/src/e3/testsuite/fragment.py +++ b/src/e3/testsuite/fragment.py @@ -39,8 +39,7 @@ class FragmentCallback(Protocol): - def __call__(self, previous_values: Dict[str, Any], slot: int) -> None: - ... + def __call__(self, previous_values: Dict[str, Any], slot: int) -> None: ... @dataclass diff --git a/src/e3/testsuite/report/display.py b/src/e3/testsuite/report/display.py index 7af5dee..c070188 100644 --- a/src/e3/testsuite/report/display.py +++ b/src/e3/testsuite/report/display.py @@ -105,8 +105,7 @@ class SupportsLessThan(Protocol): - def __lt__(self, other: SupportsLessThan) -> bool: - ... + def __lt__(self, other: SupportsLessThan) -> bool: ... KeyType = TypeVar("KeyType") diff --git a/src/e3/testsuite/report/xunit.py b/src/e3/testsuite/report/xunit.py index 3c48e9e..47f5539 100644 --- a/src/e3/testsuite/report/xunit.py +++ b/src/e3/testsuite/report/xunit.py @@ -36,7 +36,7 @@ def escape_text(text: str) -> str: for i, c in enumerate(result): # Replace non-printable characters with their Python escape sequence, # but strip quotes. - if c < ' ' and c != '\n': + if c < " " and c != "\n": result[i] = ascii(c)[1:-1] return "".join(result) @@ -197,9 +197,7 @@ def run(self, filename: str) -> None: for testcase in testsuite: # Skip "properties", "system-out" and "system-err" elements so # that we process only "testcase" ones. - if testcase.tag in { - "properties", "system-out", "system-err" - }: + if testcase.tag in {"properties", "system-out", "system-err"}: continue assert testcase.tag == "testcase" @@ -255,10 +253,14 @@ def run(self, filename: str) -> None: # test result message, create a single message for the # result to store in the report. new_message = ( - f"{message} ({xfail_message})" - if message - else xfail_message - ) if xfail_message else message + ( + f"{message} ({xfail_message})" + if message + else xfail_message + ) + if xfail_message + else message + ) # xUnit tests often use the ERROR status for issues that # are not testsuite bugs (i.e. for what we call "failures" diff --git a/tests/tests/test_multiprocessing.py b/tests/tests/test_multiprocessing.py index 1c76e34..6a8b5de 100644 --- a/tests/tests/test_multiprocessing.py +++ b/tests/tests/test_multiprocessing.py @@ -21,9 +21,11 @@ def run(self, prev, slot): def analyze(self, prev, slot): self.result.set_status( Status.PASS, - TestEnable.ENABLED_MSG - if self.env.use_multiprocessing - else TestEnable.DISABLED_MSG, + ( + TestEnable.ENABLED_MSG + if self.env.use_multiprocessing + else TestEnable.DISABLED_MSG + ), ) self.push_result() diff --git a/tox.ini b/tox.ini index e012ba5..c265a3c 100644 --- a/tox.ini +++ b/tox.ini @@ -30,11 +30,11 @@ commands= [testenv:checkstyle] basepython = python deps = - black==23.1.0 - flake8==6.0.0 + black==24.2.0 + flake8==7.0.0 flake8-docstrings flake8-rst-docstrings - mypy==1.1.1 + mypy==1.8.0 types-PyYAML types-setuptools commands =