-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-4520 Add test-async tox command and automated async testing #1699
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
Conversation
blink1073
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
|
That error will be fixed by #1678, which pulls all of the I've added a temporary fix for the issue to be removed by #1678. |
blink1073
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
|
||
| type_replacements = {"_Condition": "threading.Condition"} | ||
|
|
||
| import_replacements = {"test.synchronous": "test"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to reduce the code duplication for the conversion process, due to the bulk of our tests still using the original test/__init__.py and associated helpers. Once we've fully migrated all tests into the test/asynchronous and test/synchronous directories, we will switch to using test.synchronous.<module> again.
.evergreen/run-tests.sh
Outdated
| # https://docs.pytest.org/en/stable/how-to/capture-stdout-stderr.html | ||
| python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 $TEST_ARGS | ||
| python -m pytest -v --capture=tee-sys --durations=5 --maxfail=10 test/synchronous/ $TEST_ARGS | ||
| if [ -z "$TEST_ARGS" ]; then # TODO: remove this once test/__init__.py doesn't share with test/synchronous/__init__.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a ticket for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, created PYTHON-4528 and replaced the TODO with the ticket name.
|
Merge conflict, |
blink1073
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| test | ||
| commands = | ||
| pytest -v --durations=5 --maxfail=10 {posargs} | ||
| pytest -v --durations=5 --maxfail=10 test/synchronous/ {posargs} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does running pytest twice generate two XML reports? Which one gets uploaded?
There should be a way to run both of these in one pytest command, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'm not sure how the XML reports interact. I'll open a follow-up PR with a better solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you opened a ticket for this yet? The second XML file overwrites the first and there are actually other problems too. Like any test that relies on posargs gets run twice, for example the test_auth_oidc.py file gets run twice: https://evergreen.mongodb.com/task/mongo_python_driver_oidc_auth_test__platform~macos_oidc_auth_test_patch_636603f89371e626c41e48504c986e53f5122aaf_6696cbe31505d30007b20aae_24_07_16_19_39_11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't, sorry--this slipped past me. I don't know if there is a way to run this all in one command while keeping the existing behavior: we want to run all tests in test/ and test/asynchronous by default, but override both those directories with whatever tests are specified. We'd need a command that runs pytest ... test/ test/asynchronous/ when posargs is empty, but runs pytest ... posargs when posargs is present. The best approach I can think of is to add a check on posargs that runs one of two separate commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. Opened https://jira.mongodb.org/browse/PYTHON-4558.
The failing test
test/asynchronous/test_collection.py::AsyncTestCollection::test_find_one_and_write_concernwill be fixed by #1678.