From 8f4f431f35a250b359bacd753d959d8b4e0f24fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Le=C5=9Bniewski?= Date: Sun, 11 Sep 2022 14:34:14 +0200 Subject: [PATCH] Re-enable pytest-xdist for integration tests --- CHANGELOG.md | 1 + noxfile.py | 3 +-- test/integration/helpers.py | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8762ea785..65ca7944b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Ensured that changelog validation only happens on pull requests * Fix bucket leaks in integration tests * Allow only one CI workflow at a time +* Re-enable pytest-xdist for integration tests ## [3.6.0] - 2022-09-20 diff --git a/noxfile.py b/noxfile.py index 25cf8de10..ea54753c0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -180,9 +180,8 @@ def integration(session): """Run integration tests.""" install_myself(session) session.run('pip', 'install', *REQUIREMENTS_TEST) - #session.run('pytest', '-s', '-x', '-v', '-n', '4', *session.posargs, 'test/integration') session.run( - 'pytest', '-s', '-x', '-v', '-W', 'ignore::DeprecationWarning:rst2ansi.visitor:', + 'pytest', '-s', '-x', '-v', '-n', '4', '-W', 'ignore::DeprecationWarning:rst2ansi.visitor:', *session.posargs, 'test/integration' ) diff --git a/test/integration/helpers.py b/test/integration/helpers.py index 0a80c541b..77cc3bb02 100644 --- a/test/integration/helpers.py +++ b/test/integration/helpers.py @@ -231,7 +231,8 @@ def read_from(self, f): self.string = str(e) -@dataclasses.dataclass +# TODO: add slots=True when dropping support for Python 3.9 +@dataclasses.dataclass(frozen=True) class CommandResult: status: int stdout: str @@ -362,9 +363,10 @@ def __init__(self, command, account_id, application_key, realm): def run(self, args, additional_env: Optional[dict] = None) -> CommandResult: if args: - if args[0] == 'create-bucket': + subcommand = args[0].replace('_', '-') + if subcommand == 'create-bucket': raise ValueError(f'use {type(self).__name__}.create_bucket instead') - elif args[0] == 'delete-bucket': + elif subcommand == 'delete-bucket': raise ValueError(f'use {type(self).__name__}.delete_bucket instead') return run_command(self.command, args, additional_env)