-
Notifications
You must be signed in to change notification settings - Fork 6
Add test to run tox
warning-free in a subprocess.
#564
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -151,3 +151,30 @@ def test_docs_build( | |||||||
assert tox_docs_process.returncode == 0, ( | ||||||||
f"Something went wrong with building docs: {tox_docs_process.stderr!r}" | ||||||||
) | ||||||||
|
||||||||
|
||||||||
def test_package_tests_tox( | ||||||||
venv: pytest_venv.VirtualEnvironment, | ||||||||
generate_package: typing.Callable, | ||||||||
) -> None: | ||||||||
""" | ||||||||
Test that the package tests pass in all tox environments. | ||||||||
|
||||||||
...and that no warnings are raised (e.g. coverage). | ||||||||
""" | ||||||||
_, test_project_dir = generate_package() | ||||||||
venv.install("tox") | ||||||||
|
||||||||
tox_multienv_test_process = subprocess.run( # noqa: S603 | ||||||||
[pathlib.Path(venv.bin) / "tox"], | ||||||||
check=False, | ||||||||
cwd=test_project_dir, | ||||||||
capture_output=True, | ||||||||
) | ||||||||
|
||||||||
tests_pass = tox_multienv_test_process.returncode == 0 | ||||||||
assert tests_pass, "Template tests failed in one or more tox environments." | ||||||||
|
||||||||
return | ||||||||
output = tox_multienv_test_process.stdout.decode() | ||||||||
Comment on lines
+178
to
+179
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assertion checks stdout for warnings, but many tools including tox typically output warnings to stderr. The warning check should examine stderr instead of stdout.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should check both. |
||||||||
assert "WARNING:" not in output, f"Warnings raised during tests: {output}" |
Uh oh!
There was an error while loading. Please reload this page.