diff --git a/noxfile.py b/noxfile.py index 67bfa4eeb..3bb910dc2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -154,24 +154,30 @@ def system(session): @nox.session(python=CONFORMANCE_TEST_PYTHON_VERSIONS) def conftest_retry(session): """Run the retry conformance test suite.""" - conformance_test_path = os.path.join("tests", "conformance.py") conformance_test_folder_path = os.path.join("tests", "conformance") - conformance_test_exists = os.path.exists(conformance_test_path) conformance_test_folder_exists = os.path.exists(conformance_test_folder_path) # Environment check: only run tests if found. - if not conformance_test_exists and not conformance_test_folder_exists: + if not conformance_test_folder_exists: session.skip("Conformance tests were not found") - session.install("pytest",) + # Install all test dependencies and pytest plugin to run tests in parallel. + # Then install this package in-place. + session.install("pytest", "pytest-xdist") session.install("-e", ".") + # Run #CPU processes in parallel if no test session arguments are passed in. + if session.posargs: + test_cmd = [ + "py.test", + "--quiet", + conformance_test_folder_path, + *session.posargs, + ] + else: + test_cmd = ["py.test", "-n", "auto", "--quiet", conformance_test_folder_path] + # Run py.test against the conformance tests. - if conformance_test_exists: - session.run("py.test", "--quiet", conformance_test_path, *session.posargs) - if conformance_test_folder_exists: - session.run( - "py.test", "--quiet", conformance_test_folder_path, *session.posargs - ) + session.run(*test_cmd) @nox.session(python=DEFAULT_PYTHON_VERSION) diff --git a/tests/conformance/retry_conformance_testing.md b/tests/conformance/README.md similarity index 84% rename from tests/conformance/retry_conformance_testing.md rename to tests/conformance/README.md index 22b7c1952..3b5fa8884 100644 --- a/tests/conformance/retry_conformance_testing.md +++ b/tests/conformance/README.md @@ -27,3 +27,11 @@ To run the test suite locally: ```bash nox -s conftest_retry-3.8 ``` + +To run a single test locally: + +Single test names are displayed as "test-S{scenario_id}-{method}-{client-library-method-name}-{instructions index}", such as `test-S1-storage.buckets.get-bucket_reload-1` + +```bash +nox -re conftest_retry-3.8 -- -k +```