Skip to content

Test support for PyMongo 4.0 #46

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

Merged
merged 17 commits into from
Dec 10, 2021

Conversation

juliusgeo
Copy link
Contributor

No description provided.

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
key: ${{ runner.os }}-${{ matrix.python-version}}-pip-${{ hashFiles('**/setup.py') }}

Copy link
Member

Choose a reason for hiding this comment

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

The wheels will be different for each version of python

path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
${{ runner.os }}-pip-
${{ runner.os }}-${{ matrix.python-version}}-pip-

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -9,6 +9,11 @@ jobs:
matrix:
python-version: ["3.5", "3.6", "3.7", "3.8", "pypy-3.7"]
mongodb-version: ["4.4"]
pymongo-version: ["v3.11", "v4.0"]
# pymongo 4.0 does not support python 3.5
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you file a new issue to drop support for 3.5 if one doesn't exist already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version}}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version}}-pip-
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this needed? How much time are we saving? IIRC these tests run very fast already.

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 tests do already run fast. I mainly added this in because Steve suggested it and I thought it would be an easy way to make it run a bit faster.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay and what is the impact of this change?

Copy link
Member

Choose a reason for hiding this comment

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

It is a general thing that we add to the Jupyter repos to save time and bandwidth to pypi.org. If we don't want it here that's fine too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I get that, I just want to know how much time was actully saved in our case. How slow were the old tests and how much quicker are they now?

Copy link
Member

Choose a reason for hiding this comment

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

In this case I see about 40s -> 30s on the Python 3.8 builds.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks SGTM!

@@ -9,6 +9,11 @@ jobs:
matrix:
python-version: ["3.5", "3.6", "3.7", "3.8", "pypy-3.7"]
mongodb-version: ["4.4"]
pymongo-version: ["v3.11", "v4.0"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the v's

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. Fixed.

# pymongo 4.0 does not support python 3.5
exclude:
- python-version: "3.5"
pymongo-version: "v4.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the v here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Collaborator

@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.

So the way I see it, this change so far does ensure that we're now compatible with pymongo 4.0 but is there's still work that needs to be done in the API (new parameters added in 3.12/4.0)?

One issue here is that we're using the v3.11 era CRUD spec tests. With v4.0 we'd ideally want to use the 4.0 era CRUD tests which happen to be in the unified format.

path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version}}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version}}-pip-
Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay and what is the impact of this change?

Copy link
Collaborator

@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, please open a follow up issue for updating the spec tests themselves. We don't have to work on that ticket now but it would be good to track it. Also it would be good to confirm that there aren't any methods or parameters that need to be updated. I'm not seeing anything notable in the changelog: https://pymongo.readthedocs.io/en/3.12.0/changelog.html

path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version}}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version}}-pip-
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks SGTM!

@juliusgeo
Copy link
Contributor Author

@ShaneHarvey I created an issue to track updating the spec tests. https://jira.mongodb.org/browse/PYTHON-3039

Copy link
Collaborator

@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!

self.run_operations(sessions, collection, test['operations'])
if not hasattr(self, "command_logger"):
raise Exception("You forgot to add in the bits of code that make "
"utils_spec_runner.py test pymongoexplain!")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Neat!

@juliusgeo juliusgeo merged commit 2bce70c into mongodb-labs:master Dec 10, 2021
@ShaneHarvey ShaneHarvey mentioned this pull request Jan 6, 2022
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