Skip to content

PYTHON-1489 Merge ajdavis/pymongo-mockup-tests into pymongo #787

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 12 commits into from
Nov 17, 2021

Conversation

juliusgeo
Copy link
Contributor

No description provided.

@@ -15,6 +15,5 @@ trap "deactivatei, rm -rf mockuptests" EXIT HUP
# download it from pypi.
python -m pip install ${PROJECT_DIRECTORY}

git clone https://github.com/ajdavis/pymongo-mockup-tests.git
cd pymongo-mockup-tests
cd ../test/mockupdb
python setup.py test
Copy link
Member

@ShaneHarvey ShaneHarvey Nov 12, 2021

Choose a reason for hiding this comment

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

I'm confused how this works. The script does this:

cd ..
cd ../test/mockupdb
python setup.py test
  1. We don't need to cd at all, the venv can live in the working dir.
  2. Don't we have to install the mockup tests requirements?
  3. I don't think we can use setup.py. Instead we should use "-m unittest discover ..." to run only the tests in the test/mockupdb directory.

@@ -0,0 +1,20 @@
# Copyright 2015 MongoDB, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

You'll notice that the test suite is failing because pytohn setup.py test attempts to run tests in this directory. We can fix that problem by removing this init file.

@juliusgeo juliusgeo marked this pull request as ready for review November 16, 2021 21:01
. .evergreen/utils.sh

${PYTHON_BINARY} setup.py clean
cd ..

createvirtualenv ${PYTHON_BINARY} mockuptests
trap "deactivatei, rm -rf mockuptests" EXIT HUP
Copy link
Member

Choose a reason for hiding this comment

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

let's fix this typo: deactivatei

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.

@@ -2,19 +2,17 @@

set -o xtrace
set -o errexit

cd $PROJECT_DIRECTORY
Copy link
Member

Choose a reason for hiding this comment

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

Ideally we can run this script locally with no setup. Let's define PROJECT_DIRECTORY ourselves:

PROJECT_DIRECTORY=$(dirname $(dirname $0))

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.

git clone https://github.com/ajdavis/pymongo-mockup-tests.git
cd pymongo-mockup-tests
python setup.py test
python -m pip install mockupdb
Copy link
Member

Choose a reason for hiding this comment

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

The old tests install mockupdb@master. Let's do the same here:

python -m pip install --upgrade 'https://github.com/ajdavis/mongo-mockup-db/archive/master.zip'

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.

python setup.py test
python -m pip install mockupdb
cd ${PROJECT_DIRECTORY}/test/mockupdb
python -m unittest discover
Copy link
Member

Choose a reason for hiding this comment

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

Please add the -v flag as I suggested earlier.

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.

from pymongo import MongoClient

import unittest
from test.operations import upgrades
Copy link
Member

Choose a reason for hiding this comment

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

Does this import work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@ShaneHarvey
Copy link
Member

You've accidentally committed the virtualenv directory. Please remove it.

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

@juliusgeo juliusgeo merged commit 8fc6dc3 into mongodb:master Nov 17, 2021
juliusgeo added a commit to juliusgeo/mongo-python-driver that referenced this pull request Apr 5, 2022
juliusgeo added a commit to juliusgeo/mongo-python-driver that referenced this pull request Apr 6, 2022
juliusgeo added a commit to juliusgeo/mongo-python-driver that referenced this pull request Apr 7, 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.

2 participants