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

PYTHON-2963 Add tox config in preparation for migration from setup.py #1240

Merged
merged 6 commits into from
Jun 16, 2023

Conversation

NoahStapp
Copy link
Contributor

This change is still using python setup.py test inside tox to run the unit tests: migration to pytest will be done in https://jira.mongodb.org/browse/PYTHON-3727, and migration to pyproject.toml will be done in https://jira.mongodb.org/browse/PYTHON-2965.

[tox]
requires =
tox>=4
envlist =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lack of specified Python versions here will cause tox to run using the default system interpreter.

Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the plan is to migrate to tox in future PRs then could you update the title to something like "Add tox config"?

tox.ini Outdated
commands =
pre-commit run --all-files
pre-commit run --all-files --hook-stage manual flake8
pre-commit run --all-files --hook-stage manual doc8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-commit run --all-files --hook-stage manual will run all the pre-commit checks in one command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@NoahStapp NoahStapp changed the title PYTHON-2963 Migrate to tox from setup.py test PYTHON-2963 Add tox config in preparation for migration from setup.py Jun 15, 2023
Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update the github workflow as part of this PR to use tox.

@blink1073
Copy link
Member

Note that moving our evergreen tests to tox will involve adding new environments for things like encryption, etc, and move things out of the EG files like https://github.com/mongodb/mongo-python-driver/blob/master/.evergreen/run-tests.sh. @NoahStapp, can you please add a note to the Epic that we'll need tickets for each of those files to migrate to tox?

@NoahStapp
Copy link
Contributor Author

Note that moving our evergreen tests to tox will involve adding new environments for things like encryption, etc, and move things out of the EG files like master/.evergreen/run-tests.sh. @NoahStapp, can you please add a note to the Epic that we'll need tickets for each of those files to migrate to tox?

Sure, will do.

@NoahStapp
Copy link
Contributor Author

We should update the github workflow as part of this PR to use tox.

For all of the workflow jobs?

@blink1073
Copy link
Member

I think just the python setup.py test and the whole mypytest job for now. The linkcheck one can be done with the docs in tox ticket.

@NoahStapp NoahStapp requested a review from blink1073 June 15, 2023 20:20
echo '{"strict": ["tests/test_typing_strict.py"]}' >> pyrightconfig.json
pyright test/test_typing_strict.py

[testenv:typecheck]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this environment, we can call the individual ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended to replace needing an alias to run all of the typechecks in a single command.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it is possible then to compose this to use the deps and commands of the other envs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured it out, fixed!

@NoahStapp NoahStapp requested a review from blink1073 June 15, 2023 22:19
tox.ini Outdated
{[testenv:typecheck-pyright]deps}
allowlist_externals=echo
commands =
echo '{"strict": ["tests/test_typing_strict.py"]}' >> pyrightconfig.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>> should be > IIUC. Otherwise we'd repeatedly append to the same file.

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@NoahStapp NoahStapp merged commit 374250d into mongodb:master Jun 16, 2023
7 checks passed
@NoahStapp NoahStapp deleted the migrate-to-tox branch June 16, 2023 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants