Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: speed up retry conformance tests #655

Merged
merged 6 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <single_test_name>
```