diff options
57 files changed, 418 insertions, 233 deletions
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 91ff8ba3..37bd7c9c 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to ``tox`` +# Contributing to `tox` -Thank you for your interest in contributing to ``tox``! There are many ways to contribute, and we appreciate all of them. +Thank you for your interest in contributing to `tox`! There are many ways to contribute, and we appreciate all of them. As a reminder, all contributors are expected to follow our [Code of Conduct][coc]. [coc]: https://www.pypa.io/en/latest/code-of-conduct/ @@ -8,4 +8,4 @@ As a reminder, all contributors are expected to follow our [Code of Conduct][coc ## Development Documentation Our [development documentation](http://tox.readthedocs.org/en/latest/development.html#development) contains details on -how to get started with contributing to ``tox``, and details of our development processes. +how to get started with contributing to `tox`, and details of our development processes. diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 8b576e1e..9be623b5 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -1,18 +1,27 @@ -**Issue** +--- +name: Bug report +about: Create a report to help us improve +title: "" +labels: bug +assignees: "" +--- + +## Issue Describe what's the expected behaviour and what you're observing. -**Environment** +## Environment Provide at least: + - OS: -- ``pip list`` of the host python where ``virtualenv`` is installed: +- `pip list` of the host python where `virtualenv` is installed: ```console ``` -**Output of the virtual environment creation** +## Output of the virtual environment creation Make sure to run the creation with `-vvv --with-traceback`: diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 3a8b35e8..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: bug -assignees: '' - ---- - -**Issue** - -Describe what's the expected behaviour and what you're observing. - -**Environment** - -Provide at least: -- OS: -- ``pip list`` of the host python where ``virtualenv`` is installed: - - ```console - - ``` - -**Output of the virtual environment creation** - -Make sure to run the creation with `-vvv --with-traceback`: - -```console - -``` diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index f62de2de..f5c2efc8 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,13 +1,13 @@ # Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser -blank_issues_enabled: true # default +blank_issues_enabled: true # default contact_links: -- name: '💬 tox-dev/Lobby @ Gitter' - url: https://gitter.im/tox-dev/Lobby - about: Chat with devs -- name: 🤷💻🤦 Discourse - url: https://discuss.python.org/c/packaging - about: | - Please ask typical Q&A here: general ideas for Python packaging, questions about structuring projects and so on -- name: 📝 PyPA Code of Conduct - url: https://www.pypa.io/en/latest/code-of-conduct/ - about: ❤ Be nice to other members of the community. ☮ Behave. + - name: "💬 tox-dev/Lobby @ Gitter" + url: https://gitter.im/tox-dev/Lobby + about: Chat with devs + - name: 🤷💻🤦 Discourse + url: https://discuss.python.org/c/packaging + about: | + Please ask typical Q&A here: general ideas for Python packaging, questions about structuring projects and so on + - name: 📝 PyPA Code of Conduct + url: https://www.pypa.io/en/latest/code-of-conduct/ + about: ❤ Be nice to other members of the community. ☮ Behave. diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index 43f02241..d065c219 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -1,22 +1,25 @@ --- name: Feature request about: Suggest an enhancement for this project -title: '' +title: "" labels: enhancement -assignees: '' - +assignees: "" --- -**What's the problem this feature will solve?** +## What's the problem this feature will solve? + <!-- What are you trying to do, that you are unable to achieve with tox as it currently stands? --> -**Describe the solution you'd like** +## Describe the solution you'd like + <!-- Clear and concise description of what you want to happen. --> <!-- Provide examples of real world use cases that this would enable and how it solves the problem described above. --> -**Alternative Solutions** +## Alternative Solutions + <!-- Have you tried to workaround the problem using tox or other tools? Or a different approach to solving this issue? Please elaborate here. --> -**Additional context** +## Additional context + <!-- Add any other context, links, etc. about the feature here. --> diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f2dd7cdc..7be9e33d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,10 @@ -### Thanks for contributing, make sure you address all the checklists (for details on how see +# Thanks for contribution + +Please, make sure you address all the checklists (for details on how see [development documentation](http://tox.readthedocs.org/en/latest/development.html#development))! -- [ ] ran the linter to address style issues (``tox -e fix_lint``) +- [ ] ran the linter to address style issues (`tox -e fix_lint`) - [ ] wrote descriptive pull request text - [ ] ensured there are test(s) validating the fix -- [ ] added news fragment in ``docs/changelog`` folder +- [ ] added news fragment in `docs/changelog` folder - [ ] updated/extended the documentation diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a6a0100b..a8560f02 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -5,6 +5,10 @@ on: schedule: - cron: "0 8 * * *" +concurrency: + group: check-${{ github.ref }} + cancel-in-progress: true + jobs: pre_commit: runs-on: ubuntu-latest @@ -19,21 +23,21 @@ jobs: strategy: fail-fast: false matrix: - os: - - Ubuntu - - Windows - - MacOs py: - - "3.10.0-rc.2" - - "3.9" + - "3.10" + - "3.9.9" - "3.8" - "3.7" - "3.6" + os: + - Ubuntu + - Windows + - MacOs steps: - name: Setup python for tox uses: actions/setup-python@v2 with: - python-version: "3.10.0-rc.2" + python-version: "3.10" - uses: actions/checkout@v2 with: fetch-depth: 0 @@ -94,10 +98,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Setup Python 3.10.0-rc.2 + - name: Setup Python 3.10 uses: actions/setup-python@v2 with: - python-version: "3.10.0-rc.2" + python-version: "3.10" - name: Install self-tox run: python -m pip install . - name: Run check for ${{ matrix.tox_env }} @@ -107,13 +111,13 @@ jobs: publish: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - needs: [ check, test, pre_commit ] + needs: [check, test, pre_commit] runs-on: ubuntu-latest steps: - name: Setup python to build package uses: actions/setup-python@v2 with: - python-version: "3.10.0-rc.2" + python-version: "3.10" - name: Install build run: python -m pip install build - uses: actions/checkout@v2 diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 00000000..68e8082c --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,12 @@ +MD013: + code_blocks: false + headers: false + line_length: 120 + tables: false + +MD046: + style: fenced + +MD033: + allowed_elements: + - a diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f8de4986..f7cff580 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,57 +2,79 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.0.1 hooks: - - id: check-ast - id: check-builtin-literals - id: check-docstring-first - - id: check-merge-conflict - id: check-yaml - id: check-toml - id: debug-statements - id: end-of-file-fixer - id: trailing-whitespace + - id: check-case-conflict + - id: check-merge-conflict + - repo: https://github.com/asottile/add-trailing-comma + rev: v2.2.0 + hooks: + - id: add-trailing-comma + args: [--py36-plus] - repo: https://github.com/asottile/pyupgrade - rev: v2.29.0 + rev: v2.29.1 hooks: - id: pyupgrade args: ["--py36-plus"] exclude: "^(src/tox/util/pep517/backend.py|tests/demo_pkg_inline/build.py)$" - id: pyupgrade files: "^(src/tox/util/pep517/backend.py|tests/demo_pkg_inline/build.py)$" - - repo: https://github.com/PyCQA/isort - rev: 5.9.3 + - repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.9.0 hooks: - - id: isort + - id: rst-backticks - repo: https://github.com/psf/black - rev: 21.9b0 + rev: 21.10b0 hooks: - id: black - args: - - --safe + args: [--safe] + - repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v2.4.1" + hooks: + - id: prettier + additional_dependencies: + - prettier@2.4.1 + - "@prettier/plugin-xml@1.1.0" + args: ["--print-width=120", "--prose-wrap=always"] + - repo: https://github.com/asottile/blacken-docs + rev: v1.11.0 + hooks: + - id: blacken-docs + additional_dependencies: [black==21.10b0] - repo: https://github.com/asottile/setup-cfg-fmt - rev: v1.18.0 + rev: v1.19.0 hooks: - id: setup-cfg-fmt - args: - - --min-py3-version - - "3.6" - - --max-py-version - - "3.10" - repo: https://github.com/tox-dev/tox-ini-fmt rev: "0.5.1" hooks: - id: tox-ini-fmt - args: [ "-p", "fix" ] - - repo: https://github.com/asottile/blacken-docs - rev: v1.11.0 + args: ["-p", "fix"] + - repo: https://github.com/PyCQA/flake8 + rev: "4.0.1" hooks: - - id: blacken-docs + - id: flake8 additional_dependencies: - - black==21.8b0 - - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + - flake8-bugbear==21.9.2 + - flake8-comprehensions==3.7 + - flake8-pytest-style==1.5 + - flake8-spellcheck==0.24 + - flake8-unused-arguments==0.0.6 + - flake8-noqa==1.2 + - pep8-naming==0.12.1 + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.29.0 hooks: - - id: rst-backticks + - id: markdownlint - repo: local hooks: - id: changelogs-rst @@ -61,15 +83,7 @@ repos: entry: "changelog files must be named ####.(feature|bugfix|doc|removal|misc).rst" exclude: ^docs/changelog/(\d+\.(feature|bugfix|doc|removal|misc).rst|README.rst|template.jinja2) files: ^docs/changelog/ - - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + - repo: meta hooks: - - id: flake8 - additional_dependencies: - - flake8-bugbear==21.9.2 - - flake8-comprehensions==3.7 - - flake8-pytest-style==1.5 - - flake8-spellcheck==0.24 - - flake8-unused-arguments==0.0.6 - - flake8-noqa==1.2 - - pep8-naming==0.12.1 + - id: check-hooks-apply + - id: check-useless-excludes diff --git a/.readthedocs.yaml b/.readthedocs.yaml index dd905235..e853ba18 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -4,12 +4,12 @@ build: formats: - htmlzip python: - version: 3.8 - install: - - method: pip - path: . - extra_requirements: - - docs + version: 3.8 + install: + - method: pip + path: . + extra_requirements: + - docs sphinx: builder: html configuration: docs/conf.py @@ -1,10 +1,10 @@ +# Rewrite branch + [![check](https://github.com/tox-dev/tox/workflows/check/badge.svg)](https://github.com/tox-dev/tox/actions?query=workflow%3Acheck) [![codecov](https://codecov.io/gh/tox-dev/tox/branch/rewrite/graph/badge.svg)](https://codecov.io/gh/tox-dev/tox/branch/rewrite) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -## Rewrite branch - <a href="https://tox.readthedocs.io"> <img src="https://raw.githubusercontent.com/tox-dev/tox/master/docs/_static/img/tox.png" alt="tox logo" @@ -29,15 +29,15 @@ for what tox is. The broad goal is to: **Compatibility wise we aim to be (excluding some weird edge cases) configuration file compatible with tox 3. We'll not be API compatible though (all plugins will break).** -### Documentation +## Documentation To be done. -### Communication and questions +## Communication and questions For now reach out to [Bernat Gabor](https://github.com/gaborbernat/) directly. -### Contributing +## Contributing Contributions are welcome, though expect a lot of rough edges at this early point of development. See [contributing](https://github.com/tox-dev/tox/blob/master/CONTRIBUTING.rst) and our diff --git a/docs/_static/custom.css b/docs/_static/custom.css index 236a922a..ef2a0a70 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -1,7 +1,7 @@ blockquote { - border-left: none; - font-style: normal; - margin-left: 1.5rem; - margin-right: 0; - padding: 0; + border-left: none; + font-style: normal; + margin-left: 1.5rem; + margin-right: 0; + padding: 0; } diff --git a/docs/conf.py b/docs/conf.py index a1a6204e..72165a62 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -92,7 +92,13 @@ def skip_member(app: Sphinx, what: str, name: str, obj: Any, would_skip: bool, o def process_signature( - app: Sphinx, objtype: str, name: str, obj: Any, options: Options, args: str, retann: str | None # noqa: U100 + app: Sphinx, # noqa: U100 + objtype: str, + name: str, # noqa: U100 + obj: Any, # noqa: U100 + options: Options, + args: str, # noqa: U100 + retann: str | None, # noqa: U100 ) -> None | tuple[None, None]: # skip-member is not checked for class level docs, so disable via signature processing return (None, None) if objtype == "class" and "__init__" in options.get("exclude-members", set()) else None @@ -171,7 +177,15 @@ def setup(app: Sphinx) -> None: state_machine: RSTStateMachine, ): super().__init__( - name, arguments, options, content, lineno, content_offset, block_text, state, state_machine + name, + arguments, + options, + content, + lineno, + content_offset, + block_text, + state, + state_machine, ) self._std_domain: StandardDomain = cast(StandardDomain, self.env.get_domain("std")) diff --git a/pyproject.toml b/pyproject.toml index 506d2d38..052d1b66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools >= 44", "wheel >= 0.30", "setuptools_scm[toml]>=3.4"] +requires = ["setuptools>=58", "setuptools-scm>=6"] build-backend = "setuptools.build_meta" [tool.black] @@ -83,7 +83,7 @@ testing = pytest-xdist>=2.3 re-assert>=1.1 setuptools>=57 - setuptools_scm[toml]>=6 + setuptools-scm>=6 wheel>=0.36 [options.package_data] @@ -171,3 +171,15 @@ ignore_missing_imports = True [mypy-wheel.*] ignore_missing_imports = True + +[flake8] +max-complexity = 22 +max-line-length = 120 +unused-arguments-ignore-abstract-functions = true +noqa-require-code = true +ignore = + E203 # whitespace before ':' + W503 # line break before binary operator + +[pep8] +max-line-length = 120 @@ -1,4 +1,6 @@ -# External facing +# What's new + +## External facing 0. `Python 3.6+` only. 1. Lazy configuration - everything is materialized only when needed (don't ever generate data that will not be used - @@ -18,7 +20,7 @@ the standard error (previously this was only true for non captured commands) 8. `basepython` is now a list, the first successfully detected python will be used to generate python environment -# Internal +## Internal 0. `Python 3.6+` only with type annotated code. 1. Separate core configuration concepts from the ini system (to allow introduction of new configuration) @@ -75,7 +77,7 @@ } ``` -# TODO +## TODO - Make sure we're config compliant with tox 3 (excluding deprecated features) - CLI compliant is best effort - support for `tox.py` - inline configuration/plugins diff --git a/src/tox/config/cli/parser.py b/src/tox/config/cli/parser.py index 9193f47c..e25be60b 100644 --- a/src/tox/config/cli/parser.py +++ b/src/tox/config/cli/parser.py @@ -139,7 +139,11 @@ class ToxParser(ArgumentParserWithEnvAndConfig): if self._cmd is None: raise RuntimeError("no sub-command group allowed") sub_parser: ToxParser = self._cmd.add_parser( - cmd, help=help_msg, aliases=aliases, formatter_class=HelpFormatter, file_config=self.file_config + cmd, + help=help_msg, + aliases=aliases, + formatter_class=HelpFormatter, + file_config=self.file_config, ) sub_parser.of_cmd = cmd # mark it as parser for a sub-command content = sub_parser, handler @@ -211,7 +215,9 @@ class ToxParser(ArgumentParserWithEnvAndConfig): self.fix_defaults() def parse_known_args( # type: ignore[override] - self, args: Optional[Sequence[str]], namespace: Optional[Parsed] = None + self, + args: Optional[Sequence[str]], + namespace: Optional[Parsed] = None, ) -> Tuple[Parsed, List[str]]: if args is None: args = sys.argv[1:] @@ -244,7 +250,12 @@ def add_verbosity_flags(parser: ArgumentParser) -> None: ) verbosity = verbosity_group.add_mutually_exclusive_group() verbosity.add_argument( - "-v", "--verbose", action="count", dest="verbose", help="increase verbosity", default=DEFAULT_VERBOSITY + "-v", + "--verbose", + action="count", + dest="verbose", + help="increase verbosity", + default=DEFAULT_VERBOSITY, ) verbosity.add_argument("-q", "--quiet", action="count", dest="quiet", help="decrease verbosity", default=0) diff --git a/src/tox/config/loader/ini/__init__.py b/src/tox/config/loader/ini/__init__.py index c991a8be..76efe8b7 100644 --- a/src/tox/config/loader/ini/__init__.py +++ b/src/tox/config/loader/ini/__init__.py @@ -24,7 +24,11 @@ class IniLoader(StrConvert, Loader[str]): """Load configuration from an ini section (ini file is a string to string dictionary)""" def __init__( - self, section: Section, parser: ConfigParser, overrides: List[Override], core_section: Section + self, + section: Section, + parser: ConfigParser, + overrides: List[Override], + core_section: Section, ) -> None: self._section_proxy: SectionProxy = parser[section.key] self._parser = parser diff --git a/src/tox/config/main.py b/src/tox/config/main.py index 4c53e720..a4bd06c7 100644 --- a/src/tox/config/main.py +++ b/src/tox/config/main.py @@ -143,7 +143,10 @@ class Config: return conf_set def get_env( - self, item: str, package: bool = False, loaders: Optional[Sequence[Loader[Any]]] = None + self, + item: str, + package: bool = False, + loaders: Optional[Sequence[Loader[Any]]] = None, ) -> EnvConfigSet: """ Return the configuration for a given tox environment (will create if not exist yet). diff --git a/src/tox/config/source/api.py b/src/tox/config/source/api.py index 99e3aaa0..0cbc4feb 100644 --- a/src/tox/config/source/api.py +++ b/src/tox/config/source/api.py @@ -21,7 +21,11 @@ class Source(ABC): self._section_to_loaders: Dict[str, List[Loader[Any]]] = {} def get_loaders( - self, section: Section, base: Optional[List[str]], override_map: OverrideMap, conf: ConfigSet + self, + section: Section, + base: Optional[List[str]], + override_map: OverrideMap, + conf: ConfigSet, ) -> Iterator[Loader[Any]]: """ Return a loader that loads settings from a given section name. diff --git a/src/tox/execute/api.py b/src/tox/execute/api.py index d480f2a3..6822cf8a 100644 --- a/src/tox/execute/api.py +++ b/src/tox/execute/api.py @@ -128,12 +128,24 @@ class Execute(ABC): finally: end = time.monotonic() status.outcome = Outcome( - request, show, exit_code, out_sync.text, err_sync.text, start, end, instance.cmd, status.metadata + request, + show, + exit_code, + out_sync.text, + err_sync.text, + start, + end, + instance.cmd, + status.metadata, ) @abstractmethod def build_instance( - self, request: ExecuteRequest, options: ExecuteOptions, out: SyncWrite, err: SyncWrite + self, + request: ExecuteRequest, + options: ExecuteOptions, + out: SyncWrite, + err: SyncWrite, ) -> "ExecuteInstance": raise NotImplementedError diff --git a/src/tox/execute/local_sub_process/__init__.py b/src/tox/execute/local_sub_process/__init__.py index 0f018a49..1ff7560f 100644 --- a/src/tox/execute/local_sub_process/__init__.py +++ b/src/tox/execute/local_sub_process/__init__.py @@ -39,7 +39,11 @@ IS_WIN = sys.platform == "win32" class LocalSubProcessExecutor(Execute): def build_instance( - self, request: ExecuteRequest, options: ExecuteOptions, out: SyncWrite, err: SyncWrite + self, + request: ExecuteRequest, + options: ExecuteOptions, + out: SyncWrite, + err: SyncWrite, ) -> ExecuteInstance: return LocalSubProcessExecuteInstance(request, options, out, err) @@ -213,7 +217,10 @@ class LocalSubProcessExecuteInstance(ExecuteInstance): return status def __exit__( - self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType] + self, + exc_type: Optional[Type[BaseException]], + exc_val: Optional[BaseException], + exc_tb: Optional[TracebackType], ) -> None: if self._read_stderr is not None: self._read_stderr.__exit__(exc_type, exc_val, exc_tb) diff --git a/src/tox/execute/pep517_backend.py b/src/tox/execute/pep517_backend.py index 048ae7e8..9462e1fb 100644 --- a/src/tox/execute/pep517_backend.py +++ b/src/tox/execute/pep517_backend.py @@ -27,7 +27,11 @@ class LocalSubProcessPep517Executor(Execute): self.is_alive: bool = False def build_instance( - self, request: ExecuteRequest, options: ExecuteOptions, out: SyncWrite, err: SyncWrite + self, + request: ExecuteRequest, + options: ExecuteOptions, + out: SyncWrite, + err: SyncWrite, ) -> ExecuteInstance: result = LocalSubProcessPep517ExecuteInstance(request, options, out, err, self.local_execute(options)) return result diff --git a/src/tox/journal/main.py b/src/tox/journal/main.py index 15f2fa57..891c6582 100644 --- a/src/tox/journal/main.py +++ b/src/tox/journal/main.py @@ -23,7 +23,7 @@ class Journal: "toxversion": version, "platform": sys.platform, "host": socket.getfqdn(), - } + }, ) def get_env_journal(self, name: str) -> EnvJournal: diff --git a/src/tox/pytest.py b/src/tox/pytest.py index 3f054ff8..189bfbe7 100644 --- a/src/tox/pytest.py +++ b/src/tox/pytest.py @@ -179,7 +179,11 @@ class ToxProject: super().__init__(colored) def build_instance( - self, request: ExecuteRequest, options: ExecuteOptions, out: SyncWrite, err: SyncWrite + self, + request: ExecuteRequest, + options: ExecuteOptions, + out: SyncWrite, + err: SyncWrite, ) -> ExecuteInstance: return MockExecuteInstance(request, options, out, err, self.exit_code) @@ -203,7 +207,12 @@ class ToxProject: class MockExecuteInstance(ExecuteInstance): def __init__( - self, request: ExecuteRequest, options: ExecuteOptions, out: SyncWrite, err: SyncWrite, exit_code: int + self, + request: ExecuteRequest, + options: ExecuteOptions, + out: SyncWrite, + err: SyncWrite, + exit_code: int, ) -> None: super().__init__(request, options, out, err) self.exit_code = exit_code @@ -225,7 +234,11 @@ class ToxProject: @contextmanager def _execute_call( - self: ToxEnv, executor: Execute, out_err: OutErr, request: ExecuteRequest, show: bool + self: ToxEnv, + executor: Execute, + out_err: OutErr, + request: ExecuteRequest, + show: bool, ) -> Iterator[ExecuteStatus]: exit_code = handle(request) if exit_code is not None: @@ -393,14 +406,20 @@ class ToxRunOutcome: class ToxProjectCreator(Protocol): def __call__( - self, files: Dict[str, Any], base: Optional[Path] = None, prj_path: Optional[Path] = None # noqa: U100 + self, + files: Dict[str, Any], # noqa: U100 + base: Optional[Path] = None, # noqa: U100 + prj_path: Optional[Path] = None, # noqa: U100 ) -> ToxProject: ... @pytest.fixture(name="tox_project") def init_fixture( - tmp_path: Path, capfd: CaptureFixture, monkeypatch: MonkeyPatch, mocker: MockerFixture + tmp_path: Path, + capfd: CaptureFixture, + monkeypatch: MonkeyPatch, + mocker: MockerFixture, ) -> ToxProjectCreator: def _init(files: Dict[str, Any], base: Optional[Path] = None, prj_path: Optional[Path] = None) -> ToxProject: """create tox projects""" @@ -607,7 +626,8 @@ def disable_pip_pypi_access(_invalid_index_fake_port: int, monkeypatch: MonkeyPa @pytest.fixture(name="enable_pip_pypi_access") def enable_pip_pypi_access_fixture( - disable_pip_pypi_access: Tuple[str, Optional[str]], monkeypatch: MonkeyPatch + disable_pip_pypi_access: Tuple[str, Optional[str]], + monkeypatch: MonkeyPatch, ) -> Optional[str]: """set a fake pip index url, tests that want to use a pypi server should create and overwrite this""" _, previous_url = disable_pip_pypi_access diff --git a/src/tox/session/cmd/run/common.py b/src/tox/session/cmd/run/common.py index f24c8605..147e24b8 100644 --- a/src/tox/session/cmd/run/common.py +++ b/src/tox/session/cmd/run/common.py @@ -295,7 +295,11 @@ def _queue_and_wait( tox_env_done.teardown() name = tox_env_done.conf.name result = ToxEnvRunResult( - name=name, skipped=False, code=-3, outcomes=[], duration=MISS_DURATION + name=name, + skipped=False, + code=-3, + outcomes=[], + duration=MISS_DURATION, ) results.append(result) completed.add(result.name) diff --git a/src/tox/session/cmd/show_config.py b/src/tox/session/cmd/show_config.py index 4625fa5f..edf1fa0b 100644 --- a/src/tox/session/cmd/show_config.py +++ b/src/tox/session/cmd/show_config.py @@ -24,10 +24,18 @@ from tox.tox_env.runner import RunToxEnv def tox_add_option(parser: ToxParser) -> None: our = parser.add_command("config", ["c"], "show tox configuration", show_config) our.add_argument( - "-k", nargs="+", help="list just configuration keys specified", dest="list_keys_only", default=[], metavar="key" + "-k", + nargs="+", + help="list just configuration keys specified", + dest="list_keys_only", + default=[], + metavar="key", ) our.add_argument( - "--core", action="store_true", help="show core options too when selecting an env with -e", dest="show_core" + "--core", + action="store_true", + help="show core options too when selecting an env with -e", + dest="show_core", ) env_list_flag(our, default=CliEnv("ALL")) env_run_create_flags(our, mode="config") diff --git a/src/tox/tox_env/api.py b/src/tox/tox_env/api.py index fd28c7c0..053e1eda 100644 --- a/src/tox/tox_env/api.py +++ b/src/tox/tox_env/api.py @@ -195,7 +195,7 @@ class ToxEnv(ABC): "USERPROFILE", # needed for `os.path.expanduser()` "PATHEXT", # needed for discovering executables "MSYSTEM", # controls paths printed format - ] + ], ) else: # pragma: win32 no cover env.append("TMPDIR") # temporary file location @@ -429,7 +429,11 @@ class ToxEnv(ABC): @contextmanager def _execute_call( - self, executor: Execute, out_err: OutErr, request: ExecuteRequest, show: bool + self, + executor: Execute, + out_err: OutErr, + request: ExecuteRequest, + show: bool, ) -> Iterator[ExecuteStatus]: with executor.call( request=request, diff --git a/src/tox/tox_env/info.py b/src/tox/tox_env/info.py index bf9a8228..f1996c20 100644 --- a/src/tox/tox_env/info.py +++ b/src/tox/tox_env/info.py @@ -22,7 +22,10 @@ class Info: @contextmanager def compare( - self, value: Any, section: str, sub_section: Optional[str] = None + self, + value: Any, + section: str, + sub_section: Optional[str] = None, ) -> Iterator[Tuple[bool, Optional[Any]]]: """Cache""" old = self._content.get(section) diff --git a/src/tox/tox_env/python/api.py b/src/tox/tox_env/python/api.py index e813c40e..a9965d2d 100644 --- a/src/tox/tox_env/python/api.py +++ b/src/tox/tox_env/python/api.py @@ -89,7 +89,7 @@ class Python(ToxEnv, ABC): "SYSTEMROOT", # needed for python's crypto module "COMSPEC", # needed for distutils cygwin compiler "PROCESSOR_ARCHITECTURE", # platform.machine() - ] + ], ) env.extend(["REQUESTS_CA_BUNDLE"]) return env diff --git a/src/tox/tox_env/python/pip/req/args.py b/src/tox/tox_env/python/pip/req/args.py index 706f0bac..292bbc40 100644 --- a/src/tox/tox_env/python/pip/req/args.py +++ b/src/tox/tox_env/python/pip/req/args.py @@ -38,7 +38,10 @@ def _global_options(parser: ArgumentParser) -> None: parser.add_argument("--pre", action="store_true", default=False) parser.add_argument("--trusted-host", action=AddSortedUniqueAction) parser.add_argument( - "--use-feature", choices=["2020-resolver", "fast-deps"], action=AddSortedUniqueAction, dest="features_enabled" + "--use-feature", + choices=["2020-resolver", "fast-deps"], + action=AddSortedUniqueAction, + dest="features_enabled", ) diff --git a/src/tox/tox_env/python/runner.py b/src/tox/tox_env/python/runner.py index e68366c4..3dfd9a74 100644 --- a/src/tox/tox_env/python/runner.py +++ b/src/tox/tox_env/python/runner.py @@ -50,7 +50,10 @@ class PythonRun(Python, RunToxEnv, ABC): self.conf.add_constant(["package"], desc, "external") else: self.conf.add_config( - keys=["use_develop", "usedevelop"], desc="use develop mode", default=False, of_type=bool + keys=["use_develop", "usedevelop"], + desc="use develop mode", + default=False, + of_type=bool, ) develop_mode = self.conf["use_develop"] or getattr(self.options, "develop", False) if develop_mode: diff --git a/src/tox/tox_env/python/virtual_env/api.py b/src/tox/tox_env/python/virtual_env/api.py index 5dcc63a1..2cc14180 100644 --- a/src/tox/tox_env/python/virtual_env/api.py +++ b/src/tox/tox_env/python/virtual_env/api.py @@ -36,7 +36,7 @@ class VirtualEnv(Python, ABC): keys=["system_site_packages", "sitepackages"], of_type=bool, default=lambda conf, name: StrConvert().to_bool( - self.environment_variables.get("VIRTUALENV_SYSTEM_SITE_PACKAGES", "False") + self.environment_variables.get("VIRTUALENV_SYSTEM_SITE_PACKAGES", "False"), ), desc="create virtual environments that also have access to globally installed packages.", ) @@ -45,8 +45,9 @@ class VirtualEnv(Python, ABC): of_type=bool, default=lambda conf, name: StrConvert().to_bool( self.environment_variables.get( - "VIRTUALENV_COPIES", self.environment_variables.get("VIRTUALENV_ALWAYS_COPY", "False") - ) + "VIRTUALENV_COPIES", + self.environment_variables.get("VIRTUALENV_ALWAYS_COPY", "False"), + ), ), desc="force virtualenv to always copy rather than symlink", ) @@ -54,7 +55,7 @@ class VirtualEnv(Python, ABC): keys=["download"], of_type=bool, default=lambda conf, name: StrConvert().to_bool( - self.environment_variables.get("VIRTUALENV_DOWNLOAD", "False") + self.environment_variables.get("VIRTUALENV_DOWNLOAD", "False"), ), desc="true if you want virtualenv to upgrade pip/wheel/setuptools to the latest version", ) @@ -77,7 +78,7 @@ class VirtualEnv(Python, ABC): { "executable": str(self.base_python.extra["executable"]), "virtualenv version": virtualenv_version, - } + }, ) return base diff --git a/src/tox/tox_env/python/virtual_env/package/pep517.py b/src/tox/tox_env/python/virtual_env/package/pep517.py index 758143c7..1e22fe0f 100644 --- a/src/tox/tox_env/python/virtual_env/package/pep517.py +++ b/src/tox/tox_env/python/virtual_env/package/pep517.py @@ -189,7 +189,8 @@ class Pep517VirtualEnvPackager(PythonPackageToxEnv, VirtualEnv): return # pragma: no cover self.setup() dist_info = self._frontend.prepare_metadata_for_build_wheel( - self.meta_folder, self._wheel_config_settings + self.meta_folder, + self._wheel_config_settings, ).metadata self._distribution_meta = Distribution.at(str(dist_info)) # type: ignore[no-untyped-call] @@ -232,7 +233,10 @@ class Pep517VirtualEnvFrontend(Frontend): @contextmanager def _send_msg( - self, cmd: str, result_file: Path, msg: str # noqa: U100 + self, + cmd: str, + result_file: Path, # noqa: U100 + msg: str, # noqa: U100 ) -> Iterator[ToxCmdStatus]: # type: ignore[override] with self._tox_env.execute_async( cmd=self.backend_cmd, diff --git a/src/tox/util/pep517/frontend.py b/src/tox/util/pep517/frontend.py index 3809ac20..4cdd1c23 100644 --- a/src/tox/util/pep517/frontend.py +++ b/src/tox/util/pep517/frontend.py @@ -103,7 +103,8 @@ class Frontend(ABC): @classmethod def create_args_from_folder( - cls, folder: Path + cls, + folder: Path, ) -> Tuple[Path, Tuple[Path, ...], str, Optional[str], Tuple[Requirement, ...], bool]: py_project_toml = folder / "pyproject.toml" if py_project_toml.exists(): @@ -165,7 +166,9 @@ class Frontend(ABC): return f"{self._backend_module}{f':{self._backend_obj}' if self._backend_obj else ''}" def prepare_metadata_for_build_wheel( - self, metadata_directory: Path, config_settings: Optional[ConfigSettings] = None + self, + metadata_directory: Path, + config_settings: Optional[ConfigSettings] = None, ) -> MetadataForBuildWheelResult: if metadata_directory == self._root: raise RuntimeError(f"the project root and the metadata directory can't be the same {self._root}") @@ -187,7 +190,9 @@ class Frontend(ABC): return MetadataForBuildWheelResult(result, out, err) def _metadata_from_built_wheel( - self, config_settings: Optional[ConfigSettings], metadata_directory: Optional[Path] + self, + config_settings: Optional[ConfigSettings], + metadata_directory: Optional[Path], ) -> Tuple[str, str, str]: with self._wheel_directory() as wheel_directory: wheel_result = self.build_wheel( @@ -217,7 +222,8 @@ class Frontend(ABC): yield Path(wheel_directory) def get_requires_for_build_wheel( - self, config_settings: Optional[ConfigSettings] = None + self, + config_settings: Optional[ConfigSettings] = None, ) -> RequiresBuildWheelResult: try: result, out, err = self._send(cmd="get_requires_for_build_wheel", config_settings=config_settings) @@ -228,7 +234,8 @@ class Frontend(ABC): return RequiresBuildWheelResult(tuple(Requirement(r) for r in cast(List[str], result)), out, err) def get_requires_for_build_sdist( - self, config_settings: Optional[ConfigSettings] = None + self, + config_settings: Optional[ConfigSettings] = None, ) -> RequiresBuildSdistResult: try: result, out, err = self._send(cmd="get_requires_for_build_sdist", config_settings=config_settings) @@ -246,7 +253,7 @@ class Frontend(ABC): "cmd": cmd, "kwargs": {k: (str(v) if isinstance(v, Path) else v) for k, v in kwargs.items()}, "result": str(result_file), - } + }, ) with self._send_msg(cmd, result_file, msg) as status: while not status.done: # pragma: no branch diff --git a/src/tox/util/pep517/via_fresh_subprocess.py b/src/tox/util/pep517/via_fresh_subprocess.py index f845d4f3..20eb3591 100644 --- a/src/tox/util/pep517/via_fresh_subprocess.py +++ b/src/tox/util/pep517/via_fresh_subprocess.py @@ -42,7 +42,10 @@ class SubprocessFrontend(Frontend): @contextmanager def _send_msg( # type: ignore[override] - self, cmd: str, result_file: Path, msg: str # noqa: U100 + self, + cmd: str, # noqa: U100 + result_file: Path, # noqa: U100 + msg: str, # noqa: U100 ) -> Iterator[SubprocessCmdStatus]: env = os.environ.copy() backend = os.pathsep.join(str(i) for i in self._backend_paths).strip() diff --git a/tests/config/cli/test_cli_env_var.py b/tests/config/cli/test_cli_env_var.py index 35262e9c..9ae6a0bc 100644 --- a/tests/config/cli/test_cli_env_var.py +++ b/tests/config/cli/test_cli_env_var.py @@ -61,7 +61,8 @@ def test_verbose_no_test() -> None: def test_env_var_exhaustive_parallel_values( - monkeypatch: MonkeyPatch, core_handlers: Dict[str, Callable[[State], int]] + monkeypatch: MonkeyPatch, + core_handlers: Dict[str, Callable[[State], int]], ) -> None: monkeypatch.setenv("TOX_COMMAND", "run-parallel") monkeypatch.setenv("TOX_VERBOSE", "5") @@ -129,7 +130,10 @@ def test_ini_help(monkeypatch: MonkeyPatch, capsys: CaptureFixture) -> None: def test_bad_env_var( - monkeypatch: MonkeyPatch, capsys: CaptureFixture, caplog: LogCaptureFixture, value_error: Callable[[str], str] + monkeypatch: MonkeyPatch, + capsys: CaptureFixture, + caplog: LogCaptureFixture, + value_error: Callable[[str], str], ) -> None: monkeypatch.setenv("TOX_VERBOSE", "should-be-number") monkeypatch.setenv("TOX_QUIET", "1.00") diff --git a/tests/config/loader/ini/test_factor.py b/tests/config/loader/ini/test_factor.py index b2bad90b..ebf536eb 100644 --- a/tests/config/loader/ini/test_factor.py +++ b/tests/config/loader/ini/test_factor.py @@ -118,7 +118,7 @@ def test_factor_config(tox_ini_conf: ToxIniCreator) -> None: django15: Django>=1.5,<1.6 django16: Django>=1.6,<1.7 py36: unittest2 - """ + """, ) assert list(config) == ["py36-django15", "py36-django16", "py37-django15", "py37-django16"] for env in config.core["env_list"]: @@ -146,7 +146,7 @@ def test_factor_config_no_env_list_creates_env(tox_ini_conf: ToxIniCreator) -> N django15: Django>=1.5,<1.6 django16: Django>=1.6,<1.7 py36: unittest2 - """ + """, ) assert list(config) == ["py37-django15", "py37-django16", "py36"] @@ -160,7 +160,10 @@ def test_factor_config_no_env_list_creates_env(tox_ini_conf: ToxIniCreator) -> N ], ) def test_ini_loader_raw_with_factors( - mk_ini_conf: Callable[[str], ConfigParser], env: str, result: str, empty_config: Config + mk_ini_conf: Callable[[str], ConfigParser], + env: str, + result: str, + empty_config: Config, ) -> None: commands = "python -m coverage html -d cov \n !py35: --show-contexts" loader = IniLoader( diff --git a/tests/config/test_set_env.py b/tests/config/test_set_env.py index 001877d4..bb4e7afd 100644 --- a/tests/config/test_set_env.py +++ b/tests/config/test_set_env.py @@ -35,7 +35,10 @@ def test_set_env_bad_line() -> None: class EvalSetEnv(Protocol): def __call__( - self, tox_ini: str, extra_files: Optional[Dict[str, Any]] = ..., from_cwd: Optional[Path] = ... # noqa: U100 + self, + tox_ini: str, # noqa: U100 + extra_files: Optional[Dict[str, Any]] = ..., # noqa: U100 + from_cwd: Optional[Path] = ..., # noqa: U100 ) -> SetEnv: ... diff --git a/tests/config/test_sets.py b/tests/config/test_sets.py index 2b26d0fc..50a98ca8 100644 --- a/tests/config/test_sets.py +++ b/tests/config/test_sets.py @@ -48,7 +48,10 @@ def test_config_set(conf_builder: ConfBuilder) -> None: def test_config_optional_none(conf_builder: ConfBuilder) -> None: config_set = conf_builder("") config_set.add_config( - keys="optional_none", of_type=Optional[int], default=None, desc="optional_none" # type: ignore[arg-type] + keys="optional_none", + of_type=Optional[int], # type: ignore[arg-type] + default=None, + desc="optional_none", ) optional_none = config_set["optional_none"] assert optional_none is None diff --git a/tests/demo_pkg_inline/build.py b/tests/demo_pkg_inline/build.py index 212a4571..534c9b7a 100644 --- a/tests/demo_pkg_inline/build.py +++ b/tests/demo_pkg_inline/build.py @@ -33,7 +33,8 @@ content = { UNKNOWN """.format( - pkg_name, version + pkg_name, + version, ), wheel: """ Wheel-Version: 1.0 @@ -41,7 +42,9 @@ content = { Root-Is-Purelib: true Tag: py{}-none-any """.format( - name, version, sys.version_info[0] + name, + version, + sys.version_info[0], ), "{}/top_level.txt".format(dist_info): name, record: """ @@ -51,7 +54,8 @@ content = { {1}/top_level.txt,, {1}/RECORD,, """.format( - name, dist_info + name, + dist_info, ), } diff --git a/tests/execute/local_subprocess/test_local_subprocess.py b/tests/execute/local_subprocess/test_local_subprocess.py index 126a724b..c7b01baf 100644 --- a/tests/execute/local_subprocess/test_local_subprocess.py +++ b/tests/execute/local_subprocess/test_local_subprocess.py @@ -199,7 +199,11 @@ def test_command_does_not_exist(caplog: LogCaptureFixture, os_env: Dict[str, str caplog.set_level(logging.NOTSET) executor = LocalSubProcessExecutor(colored=False) request = ExecuteRequest( - cmd=["sys-must-be-missing"], cwd=Path().absolute(), env=os_env, stdin=StdinSource.OFF, run_id="" + cmd=["sys-must-be-missing"], + cwd=Path().absolute(), + env=os_env, + stdin=StdinSource.OFF, + run_id="", ) out_err = FakeOutErr() with executor.call(request, show=False, out_err=out_err.out_err, env=MagicMock()) as status: diff --git a/tests/pytest_/test_init.py b/tests/pytest_/test_init.py index 3dfdaebc..8e7732c8 100644 --- a/tests/pytest_/test_init.py +++ b/tests/pytest_/test_init.py @@ -100,7 +100,7 @@ def test_tox_run_outcome_repr(tox_project: ToxProjectCreator) -> None: standard output additional environments: py -> [no description] - """ + """, ).lstrip() assert repr(outcome) == msg assert outcome.shell_cmd == f"{sys.executable} -m tox l" diff --git a/tests/session/cmd/test_depends.py b/tests/session/cmd/test_depends.py index b68759f4..98d6c555 100644 --- a/tests/session/cmd/test_depends.py +++ b/tests/session/cmd/test_depends.py @@ -8,7 +8,9 @@ from tox.pytest import ToxProjectCreator @pytest.mark.parametrize("has_prev", [True, False]) def test_depends( - tox_project: ToxProjectCreator, patch_prev_py: Callable[[bool], Tuple[str, str]], has_prev: bool + tox_project: ToxProjectCreator, + patch_prev_py: Callable[[bool], Tuple[str, str]], + has_prev: bool, ) -> None: prev_ver, impl = patch_prev_py(has_prev) ver = sys.version_info[0:2] @@ -44,7 +46,7 @@ def test_depends( " cov", " py ~ .pkg", f" {py} ~ .pkg", - ] + ], ) if has_prev: expected_lines.append(f" {prev_py} ~ .pkg | .pkg-{impl}{prev_ver}") @@ -53,7 +55,7 @@ def test_depends( " cov", " py ~ .pkg", f" {py} ~ .pkg", - ] + ], ) if has_prev: expected_lines.append(f" {prev_py} ~ .pkg | .pkg-{impl}{prev_ver}") diff --git a/tests/session/cmd/test_parallel.py b/tests/session/cmd/test_parallel.py index 5ed38236..558a9c80 100644 --- a/tests/session/cmd/test_parallel.py +++ b/tests/session/cmd/test_parallel.py @@ -128,7 +128,7 @@ def test_keyboard_interrupt(tox_project: ToxProjectCreator, demo_pkg_inline: Pat "tox.ini": ini, "pyproject.toml": (demo_pkg_inline / "pyproject.toml").read_text(), "build.py": (demo_pkg_inline / "build.py").read_text(), - } + }, ) cmd = ["-c", str(proj.path / "tox.ini"), "p", "-p", "1", "-e", f"py,py{sys.version_info[0]},dep"] process = Popen([sys.executable, "-m", "tox"] + cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) diff --git a/tests/session/cmd/test_sequential.py b/tests/session/cmd/test_sequential.py index 1054f150..6c83ad97 100644 --- a/tests/session/cmd/test_sequential.py +++ b/tests/session/cmd/test_sequential.py @@ -42,7 +42,8 @@ def test_run_sequential_fail(tox_project: ToxProjectCreator) -> None: @pytest.mark.integration() def test_result_json_sequential( - tox_project: ToxProjectCreator, enable_pip_pypi_access: Optional[str] # noqa: U100 + tox_project: ToxProjectCreator, + enable_pip_pypi_access: Optional[str], # noqa: U100 ) -> None: cmd = [ "- python -c 'import sys; print(\"magic fail\", file=sys.stderr); sys.exit(1)'", @@ -55,7 +56,7 @@ def test_result_json_sequential( "install_requires=['setuptools>44'])", "run.py": "print('run')", "pyproject.toml": '[build-system]\nrequires=["setuptools","wheel"]\nbuild-backend="setuptools.build_meta"', - } + }, ) log = project.path / "log.json" outcome = project.run("r", "-vv", "-e", "py", "--result-json", str(log)) @@ -131,7 +132,7 @@ def test_rerun_sequential_skip(tox_project: ToxProjectCreator, demo_pkg_inline: def test_rerun_sequential_wheel(tox_project: ToxProjectCreator, demo_pkg_inline: Path) -> None: proj = tox_project( - {"tox.ini": "[testenv]\npackage=wheel\ncommands=python -c 'from demo_pkg_inline import do; do()'"} + {"tox.ini": "[testenv]\npackage=wheel\ncommands=python -c 'from demo_pkg_inline import do; do()'"}, ) result_first = proj.run("--root", str(demo_pkg_inline)) result_first.assert_success() @@ -142,7 +143,7 @@ def test_rerun_sequential_wheel(tox_project: ToxProjectCreator, demo_pkg_inline: @pytest.mark.integration() def test_rerun_sequential_sdist(tox_project: ToxProjectCreator, demo_pkg_inline: Path) -> None: proj = tox_project( - {"tox.ini": "[testenv]\npackage=sdist\ncommands=python -c 'from demo_pkg_inline import do; do()'"} + {"tox.ini": "[testenv]\npackage=sdist\ncommands=python -c 'from demo_pkg_inline import do; do()'"}, ) result_first = proj.run("--root", str(demo_pkg_inline)) result_first.assert_success() @@ -152,7 +153,7 @@ def test_rerun_sequential_sdist(tox_project: ToxProjectCreator, demo_pkg_inline: def test_recreate_package(tox_project: ToxProjectCreator, demo_pkg_inline: Path) -> None: proj = tox_project( - {"tox.ini": "[testenv]\npackage=wheel\ncommands=python -c 'from demo_pkg_inline import do; do()'"} + {"tox.ini": "[testenv]\npackage=wheel\ncommands=python -c 'from demo_pkg_inline import do; do()'"}, ) result_first = proj.run("--root", str(demo_pkg_inline), "-r") result_first.assert_success() @@ -191,7 +192,7 @@ def test_package_build_fails(tox_project: ToxProjectCreator) -> None: "tox.ini": "[testenv]\npackage=wheel", "pyproject.toml": '[build-system]\nrequires=[]\nbuild-backend="build"\nbackend-path=["."]', "build.py": "", - } + }, ) result = proj.run("r") @@ -205,7 +206,7 @@ def test_backend_not_found(tox_project: ToxProjectCreator) -> None: "tox.ini": "[testenv]\npackage=wheel", "pyproject.toml": '[build-system]\nrequires=[]\nbuild-backend="build"', "build.py": "", - } + }, ) result = proj.run("r") diff --git a/tests/session/cmd/test_show_config.py b/tests/session/cmd/test_show_config.py index 3002c80a..b631d765 100644 --- a/tests/session/cmd/test_show_config.py +++ b/tests/session/cmd/test_show_config.py @@ -111,11 +111,12 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty: def test_show_config_pkg_env_once( - tox_project: ToxProjectCreator, patch_prev_py: Callable[[bool], Tuple[str, str]] + tox_project: ToxProjectCreator, + patch_prev_py: Callable[[bool], Tuple[str, str]], ) -> None: prev_ver, impl = patch_prev_py(True) project = tox_project( - {"tox.ini": f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel", "pyproject.toml": ""} + {"tox.ini": f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel", "pyproject.toml": ""}, ) result = project.run("c") result.assert_success() @@ -126,11 +127,12 @@ def test_show_config_pkg_env_once( def test_show_config_pkg_env_skip( - tox_project: ToxProjectCreator, patch_prev_py: Callable[[bool], Tuple[str, str]] + tox_project: ToxProjectCreator, + patch_prev_py: Callable[[bool], Tuple[str, str]], ) -> None: prev_ver, impl = patch_prev_py(False) project = tox_project( - {"tox.ini": f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel", "pyproject.toml": ""} + {"tox.ini": f"[tox]\nenv_list=py{prev_ver},py\n[testenv]\npackage=wheel", "pyproject.toml": ""}, ) result = project.run("c") result.assert_success() diff --git a/tests/session/cmd/test_state.py b/tests/session/cmd/test_state.py index a9dccd83..7350584d 100644 --- a/tests/session/cmd/test_state.py +++ b/tests/session/cmd/test_state.py @@ -6,7 +6,7 @@ def test_env_already_packaging(tox_project: ToxProjectCreator) -> None: { "tox.ini": "[testenv]\npackage=wheel", "pyproject.toml": '[build-system]\nrequires=[]\nbuild-backend="build"', - } + }, ) result = proj.run("r", "-e", "py,.pkg") result.assert_failed(code=-2) diff --git a/tests/test_provision.py b/tests/test_provision.py index 226e723a..b3060111 100644 --- a/tests/test_provision.py +++ b/tests/test_provision.py @@ -34,7 +34,9 @@ def elapsed(msg: str) -> Iterator[None]: @pytest.fixture(scope="session") def tox_wheel( - tmp_path_factory: TempPathFactory, worker_id: str, pkg_builder: Callable[[Path, Path, List[str], bool], Path] + tmp_path_factory: TempPathFactory, + worker_id: str, + pkg_builder: Callable[[Path, Path, List[str], bool], Path], ) -> Path: if worker_id == "master": # if not running under xdist we can just return return _make_tox_wheel(tmp_path_factory, pkg_builder) # pragma: no cover @@ -51,7 +53,8 @@ def tox_wheel( def _make_tox_wheel( - tmp_path_factory: TempPathFactory, pkg_builder: Callable[[Path, Path, List[str], bool], Path] + tmp_path_factory: TempPathFactory, + pkg_builder: Callable[[Path, Path, List[str], bool], Path], ) -> Path: with elapsed("acquire current tox wheel"): # takes around 3.2s on build package: Optional[Path] = None @@ -112,7 +115,10 @@ def test_provision_requires_nok(tox_project: ToxProjectCreator) -> None: @pytest.mark.integration() def test_provision_requires_ok( - tox_project: ToxProjectCreator, pypi_index_self: Index, monkeypatch: MonkeyPatch, tmp_path: Path + tox_project: ToxProjectCreator, + pypi_index_self: Index, + monkeypatch: MonkeyPatch, + tmp_path: Path, ) -> None: pypi_index_self.use(monkeypatch) proj = tox_project({"tox.ini": "[tox]\nrequires=demo-pkg-inline\n[testenv]\npackage=skip"}) @@ -147,7 +153,9 @@ def test_provision_requires_ok( @pytest.mark.integration() def test_provision_platform_check( - tox_project: ToxProjectCreator, pypi_index_self: Index, monkeypatch: MonkeyPatch + tox_project: ToxProjectCreator, + pypi_index_self: Index, + monkeypatch: MonkeyPatch, ) -> None: pypi_index_self.use(monkeypatch) ini = "[tox]\nrequires=demo-pkg-inline\n[testenv]\npackage=skip\n[testenv:.tox]\nplatform=wrong_platform" diff --git a/tests/tox_env/python/pip/req/test_file.py b/tests/tox_env/python/pip/req/test_file.py index d66a0ca3..e7a7507c 100644 --- a/tests/tox_env/python/pip/req/test_file.py +++ b/tests/tox_env/python/pip/req/test_file.py @@ -142,7 +142,11 @@ _REQ_FILE_TEST_CASES = [ pytest.param("--no-binary :none:", {"no_binary": ":none:"}, [], ["--no-binary", ":none:"], id="no-binary none"), pytest.param("--only-binary :all:", {"only_binary": ":all:"}, [], ["--only-binary", ":all:"], id="only-binary all"), pytest.param( - "--only-binary :none:", {"only_binary": ":none:"}, [], ["--only-binary", ":none:"], id="only-binary none" + "--only-binary :none:", + {"only_binary": ":none:"}, + [], + ["--only-binary", ":none:"], + id="only-binary none", ), pytest.param("####### example-requirements.txt #######", {}, [], [], id="comment"), pytest.param("\t##### Requirements without Version Specifiers ######", {}, [], [], id="tab and comment"), @@ -238,7 +242,7 @@ _REQ_FILE_TEST_CASES = [ {}, [ "attrs --hash sha256:af957b369adcd07e5b3c64d2cdb76d6808c5e0b16c35ca41c79c8eee34808152 --hash sha384:" - "142d9b02f3f4511ccabf6c14bd34d2b0a9ed043a898228b48343cfdf4eb10856ef7ad5e2ff2c528ecae04912224782ab" + "142d9b02f3f4511ccabf6c14bd34d2b0a9ed043a898228b48343cfdf4eb10856ef7ad5e2ff2c528ecae04912224782ab", ], ["attrs"], id="hash", @@ -250,7 +254,7 @@ _REQ_FILE_TEST_CASES = [ {}, [ "attrs --hash sha256:af957b369adcd07e5b3c64d2cdb76d6808c5e0b16c35ca41c79c8eee34808152 --hash sha384:" - "142d9b02f3f4511ccabf6c14bd34d2b0a9ed043a898228b48343cfdf4eb10856ef7ad5e2ff2c528ecae04912224782ab" + "142d9b02f3f4511ccabf6c14bd34d2b0a9ed043a898228b48343cfdf4eb10856ef7ad5e2ff2c528ecae04912224782ab", ], ["attrs"], id="hash with escaped newline", @@ -261,7 +265,7 @@ _REQ_FILE_TEST_CASES = [ {}, [ "attrs --hash sha512:7a91e5a3d1a1238525e477385ef5ee6cecdc8f8fcc2a79d1b35a9f57ad15c814" - "dada670026f41fdd62e5e10b3fd75d6112704a9521c3df105f0b6f3bb11b128a" + "dada670026f41fdd62e5e10b3fd75d6112704a9521c3df105f0b6f3bb11b128a", ], ["attrs"], id="sha512 hash is supported", diff --git a/tests/tox_env/python/pip/test_pip_install.py b/tests/tox_env/python/pip/test_pip_install.py index b1d4208d..f17a3991 100644 --- a/tests/tox_env/python/pip/test_pip_install.py +++ b/tests/tox_env/python/pip/test_pip_install.py @@ -133,7 +133,7 @@ def test_pkg_dep_remove_recreate(tox_project: ToxProjectCreator, demo_pkg_inline "tox.ini": "[testenv]\npackage=wheel", "pyproject.toml": (demo_pkg_inline / "pyproject.toml").read_text(), "build.py": build_with_dep, - } + }, ) execute_calls = proj.patch_execute(lambda r: 0 if "install" in r.run_id else None) @@ -164,7 +164,7 @@ def test_pkg_env_dep_remove_recreate(tox_project: ToxProjectCreator, demo_pkg_in "tox.ini": "[testenv]\npackage=wheel", "pyproject.toml": toml.replace("requires = []", 'requires = ["setuptools"]'), "build.py": (demo_pkg_inline / "build.py").read_text(), - } + }, ) execute_calls = proj.patch_execute(lambda r: 0 if "install" in r.run_id else None) result_first = proj.run("r") diff --git a/tests/tox_env/python/test_python_api.py b/tests/tox_env/python/test_python_api.py index 2204a22a..01a1694c 100644 --- a/tests/tox_env/python/test_python_api.py +++ b/tests/tox_env/python/test_python_api.py @@ -15,7 +15,7 @@ def test_requirements_txt(tox_project: ToxProjectCreator) -> None: { "tox.ini": "[testenv]\npackage=skip\ndeps=-rrequirements.txt", "requirements.txt": "nose", - } + }, ) execute_calls = prj.patch_execute(lambda r: 0 if "install" in r.run_id else None) result = prj.run("r", "-e", "py") diff --git a/tests/tox_env/python/test_python_runner.py b/tests/tox_env/python/test_python_runner.py index 43163ef5..eadb55df 100644 --- a/tests/tox_env/python/test_python_runner.py +++ b/tests/tox_env/python/test_python_runner.py @@ -12,7 +12,7 @@ def test_deps_config_path_req(tox_project: ToxProjectCreator) -> None: "tox.ini": "[testenv:py]\ndeps =-rpath.txt\n -r {toxinidir}{/}path2.txt\n pytest", "path.txt": "alpha", "path2.txt": "beta", - } + }, ) result = project.run("c", "-e", "py") result.assert_success() @@ -44,7 +44,7 @@ def test_journal_one_wheel_file(tmp_path: Path) -> None: "basename": "a.whl", "sha256": "0ce2d4c7087733c06b1087b28db95e114d7caeb515b841c6cdec8960cf884654", "type": "file", - } + }, } @@ -70,7 +70,7 @@ def test_journal_multiple_wheel_file(tmp_path: Path) -> None: "sha256": "3be7a505483c0050243c5cbad4700da13925aa4137a55e9e33efd8bc4d05850f", "type": "file", }, - ] + ], } @@ -84,5 +84,5 @@ def test_journal_package_dir(tmp_path: Path) -> None: "installpkg": { "basename": tmp_path.name, "type": "dir", - } + }, } diff --git a/tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py b/tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py index 6a1b6065..0206476f 100644 --- a/tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py +++ b/tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py @@ -9,7 +9,8 @@ from tox.pytest import ToxProjectCreator @pytest.fixture(scope="session") def pkg_with_extras_project_wheel( - pkg_with_extras_project: Path, pkg_builder: Callable[[Path, Path, List[str], bool], Path] + pkg_with_extras_project: Path, + pkg_builder: Callable[[Path, Path, List[str], bool], Path], ) -> Path: dist = pkg_with_extras_project / "dist" pkg_builder(dist, pkg_with_extras_project, ["wheel"], False) @@ -32,7 +33,8 @@ def test_tox_install_pkg_wheel(tox_project: ToxProjectCreator, pkg_with_extras_p @pytest.fixture() def pkg_with_extras_project_sdist( - pkg_with_extras_project: Path, pkg_builder: Callable[[Path, Path, List[str], bool], Path] + pkg_with_extras_project: Path, + pkg_builder: Callable[[Path, Path, List[str], bool], Path], ) -> Path: dist = pkg_with_extras_project / "sdist" pkg_builder(dist, pkg_with_extras_project, ["sdist"], False) diff --git a/tests/tox_env/python/virtual_env/test_virtualenv_api.py b/tests/tox_env/python/virtual_env/test_virtualenv_api.py index 27d810aa..e3b1f391 100644 --- a/tests/tox_env/python/virtual_env/test_virtualenv_api.py +++ b/tests/tox_env/python/virtual_env/test_virtualenv_api.py @@ -46,10 +46,12 @@ def test_virtualenv_default_settings(tox_project: ToxProjectCreator, virtualenv_ def test_virtualenv_flipped_settings( - tox_project: ToxProjectCreator, virtualenv_opt: VirtualEnvOptions, monkeypatch: MonkeyPatch + tox_project: ToxProjectCreator, + virtualenv_opt: VirtualEnvOptions, + monkeypatch: MonkeyPatch, ) -> None: proj = tox_project( - {"tox.ini": "[testenv]\npackage=skip\nsystem_site_packages=True\nalways_copy=True\ndownload=True"} + {"tox.ini": "[testenv]\npackage=skip\nsystem_site_packages=True\nalways_copy=True\ndownload=True"}, ) monkeypatch.setenv("VIRTUALENV_CLEAR", "0") @@ -69,7 +71,9 @@ def test_virtualenv_flipped_settings( def test_virtualenv_env_ignored_if_set( - tox_project: ToxProjectCreator, virtualenv_opt: VirtualEnvOptions, monkeypatch: MonkeyPatch + tox_project: ToxProjectCreator, + virtualenv_opt: VirtualEnvOptions, + monkeypatch: MonkeyPatch, ) -> None: ini = "[testenv]\npackage=skip\nsystem_site_packages=True\nalways_copy=True\ndownload=True" proj = tox_project({"tox.ini": ini}) @@ -80,7 +84,9 @@ def test_virtualenv_env_ignored_if_set( def test_virtualenv_env_used_if_not_set( - tox_project: ToxProjectCreator, virtualenv_opt: VirtualEnvOptions, monkeypatch: MonkeyPatch + tox_project: ToxProjectCreator, + virtualenv_opt: VirtualEnvOptions, + monkeypatch: MonkeyPatch, ) -> None: proj = tox_project({"tox.ini": "[testenv]\npackage=skip"}) monkeypatch.setenv("VIRTUALENV_COPIES", "1") @@ -102,7 +108,8 @@ def run_and_check_set(proj: ToxProject, virtualenv_opt: VirtualEnvOptions) -> No def test_honor_set_env_for_clear_periodic_update( - tox_project: ToxProjectCreator, virtualenv_opt: VirtualEnvOptions + tox_project: ToxProjectCreator, + virtualenv_opt: VirtualEnvOptions, ) -> None: ini = "[testenv]\npackage=skip\nset_env=\n VIRTUALENV_CLEAR=0\n VIRTUALENV_NO_PERIODIC_UPDATE=0" proj = tox_project({"tox.ini": ini}) diff --git a/tests/util/test_pep517.py b/tests/util/test_pep517.py index 18042023..386b8726 100644 --- a/tests/util/test_pep517.py +++ b/tests/util/test_pep517.py @@ -23,7 +23,7 @@ else: # pragma: no cover (<py38) def frontend_setuptools(tmp_path_factory: TempPathFactory) -> SubprocessFrontend: prj = tmp_path_factory.mktemp("proj") (prj / "pyproject.toml").write_text( - '[build-system]\nrequires=["setuptools","wheel"]\nbuild-backend = "setuptools.build_meta"' + '[build-system]\nrequires=["setuptools","wheel"]\nbuild-backend = "setuptools.build_meta"', ) cfg = """ [metadata] @@ -66,7 +66,8 @@ def test_pep517_setuptools_get_requires_for_build_wheel(frontend_setuptools: Sub def test_pep517_setuptools_prepare_metadata_for_build_wheel( - frontend_setuptools: SubprocessFrontend, tmp_path: Path + frontend_setuptools: SubprocessFrontend, + tmp_path: Path, ) -> None: meta = tmp_path / "meta" result = frontend_setuptools.prepare_metadata_for_build_wheel(metadata_directory=meta) @@ -242,8 +243,8 @@ def test_pep517_backend_obj(tmp_path: Path) -> None: requires=[] build-backend = "build.api:backend:" backend-path=["."] - """ - ) + """, + ), ) build = tmp_path / "build" build.mkdir() @@ -256,8 +257,8 @@ def test_pep517_backend_obj(tmp_path: Path) -> None: return ["a"] backend = A() - """ - ) + """, + ), ) fronted = SubprocessFrontend(*SubprocessFrontend.create_args_from_folder(tmp_path)[:-1]) result = fronted.get_requires_for_build_sdist() @@ -133,13 +133,3 @@ extras = commands = python -m pip list --format=columns python -c "print(r'{envpython}')" - -[flake8] -max-complexity = 22 -max-line-length = 120 -ignore = E203, W503 -unused-arguments-ignore-abstract-functions = true -noqa-require-code = true - -[pep8] -max-line-length = 120 |