Skip to content

Commit 9e3f1d9

Browse files
authored
Merge pull request #2804 from bagerard/remove_setup_py_test
Remove 'python setup.py test' usage in tox
2 parents ce9e108 + bd58f95 commit 9e3f1d9

File tree

13 files changed

+43
-126
lines changed

13 files changed

+43
-126
lines changed

.github/workflows/github-actions.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ env:
2626
PYMONGO_3_11: 3.11
2727
PYMONGO_3_12: 3.12
2828
PYMONGO_4_0: 4.0
29-
PYMONGO_4_3: 4.3.2
29+
PYMONGO_4_3: 4.3.3
3030
PYMONGO_4_4: 4.4.1
31-
PYMONGO_4_6: 4.6.0
31+
PYMONGO_4_6: 4.6.2
3232

33-
MAIN_PYTHON_VERSION: 3.7
33+
MAIN_PYTHON_VERSION: 3.9
3434

3535
jobs:
3636
linting:
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
fail-fast: false
5555
matrix:
56-
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, "pypy3.9"]
56+
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, pypy3.9, pypy3.10]
5757
MONGODB: [$MONGODB_4_0]
5858
PYMONGO: [$PYMONGO_3_11]
5959
include:
@@ -91,9 +91,9 @@ jobs:
9191
bash .github/workflows/install_ci_python_dep.sh
9292
bash .github/workflows/start_mongo.sh ${{ matrix.MONGODB }}
9393
- name: tox dry-run (to pre-install venv)
94-
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- -a "-k=test_ci_placeholder"
94+
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- "-k=test_ci_placeholder"
9595
- name: Run test suite
96-
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- -a "--cov=mongoengine"
96+
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- "--cov=mongoengine"
9797
- name: Send coverage to Coveralls
9898
env:
9999
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
fail_fast: false
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.4.0
4+
rev: v4.5.0
55
hooks:
66
- id: check-merge-conflict
77
- id: debug-statements
88
- id: trailing-whitespace
99
- id: end-of-file-fixer
1010
- repo: https://github.com/ambv/black
11-
rev: 23.9.1
11+
rev: 24.2.0
1212
hooks:
1313
- id: black
1414
- repo: https://github.com/pycqa/flake8
15-
rev: 6.1.0
15+
rev: 7.0.0
1616
hooks:
1717
- id: flake8
1818
additional_dependencies:
1919
- importlib_metadata<5
2020
- repo: https://github.com/asottile/pyupgrade
21-
rev: v3.14.0
21+
rev: v3.15.1
2222
hooks:
2323
- id: pyupgrade
2424
args: [--py36-plus]
2525
- repo: https://github.com/pycqa/isort
26-
rev: 5.12.0
26+
rev: 5.13.2
2727
hooks:
2828
- id: isort

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ General Guidelines
8282
should adapt to the breaking change in docs/upgrade.rst.
8383
- Write inline documentation for new classes and methods.
8484
- Write tests and make sure they pass (make sure you have a mongod
85-
running on the default port, then execute ``python setup.py test``
85+
running on the default port, then execute ``pytest tests/``
8686
from the cmd line to run the test suite).
8787
- Ensure tests pass on all supported Python, PyMongo, and MongoDB versions.
8888
You can test various Python and PyMongo versions locally by executing

README.rst

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ Some simple examples of what MongoEngine code looks like:
125125
Tests
126126
=====
127127
To run the test suite, ensure you are running a local instance of MongoDB on
128-
the standard port and have ``pytest`` installed. Then, run ``python setup.py test``
129-
or simply ``pytest``.
128+
the standard port and have ``pytest`` installed. Then, run ``pytest tests/``.
130129

131130
To run the test suite on every supported Python and PyMongo version, you can
132131
use ``tox``. You'll need to make sure you have each supported Python version
@@ -139,15 +138,6 @@ installed in your environment and then:
139138
# Run the test suites
140139
$ tox
141140
142-
If you wish to run a subset of tests, use the pytest convention:
143-
144-
.. code-block:: shell
145-
146-
# Run all the tests in a particular test file
147-
$ pytest tests/fields/test_fields.py
148-
# Run only particular test class in that file
149-
$ pytest tests/fields/test_fields.py::TestField
150-
151141
Community
152142
=========
153143
- `MongoEngine Users mailing list

benchmarks/test_basic_doc_ops.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,9 @@ def save_book():
6060
print("Save to database: %.3fus" % (timeit(save_book, 100) * 10**6))
6161

6262
son = b.to_mongo()
63-
print(
64-
"Load from SON: %.3fus" % (timeit(lambda: Book._from_son(son), 1000) * 10**6)
65-
)
63+
print("Load from SON: %.3fus" % (timeit(lambda: Book._from_son(son), 1000) * 10**6))
6664

67-
print(
68-
"Load from database: %.3fus" % (timeit(lambda: Book.objects[0], 100) * 10**6)
69-
)
65+
print("Load from database: %.3fus" % (timeit(lambda: Book.objects[0], 100) * 10**6))
7066

7167
def create_and_delete_book():
7268
b = init_book()
@@ -116,13 +112,11 @@ def save_company():
116112

117113
son = company.to_mongo()
118114
print(
119-
"Load from SON: %.3fms"
120-
% (timeit(lambda: Company._from_son(son), 100) * 10**3)
115+
"Load from SON: %.3fms" % (timeit(lambda: Company._from_son(son), 100) * 10**3)
121116
)
122117

123118
print(
124-
"Load from database: %.3fms"
125-
% (timeit(lambda: Company.objects[0], 100) * 10**3)
119+
"Load from database: %.3fms" % (timeit(lambda: Company.objects[0], 100) * 10**3)
126120
)
127121

128122
def create_and_delete_company():

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Changelog
77
Development
88
===========
99
- (Fill this out as you fix issues and develop your features).
10+
- Switch tox to use pytest instead of legacy `python setup.py test` #2804
1011

1112
Changes in 0.28.2
1213
=================

mongoengine/mongodb_support.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Helper functions, constants, and types to aid with MongoDB version support
33
"""
4+
45
from mongoengine.connection import get_connection
56

67
# Constant that can be used to compare the version retrieved with

mongoengine/pymongo_support.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Helper functions, constants, and types to aid with PyMongo support.
33
"""
4+
45
import pymongo
56
from bson import binary, json_util
67
from pymongo.errors import OperationFailure

mongoengine/signals.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def _fail(self, *args, **kwargs):
3838
)
3939

4040
send = lambda *a, **kw: None # noqa
41-
connect = (
42-
disconnect
43-
) = has_receivers_for = receivers_for = temporarily_connected_to = _fail
41+
connect = disconnect = has_receivers_for = receivers_for = (
42+
temporarily_connected_to
43+
) = _fail
4444
del _fail
4545

4646

requirements-dev.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
black
2-
flake8
31
pre-commit
4-
pytest
52
ipdb
63
ipython
74
tox
5+
-e .[test]

0 commit comments

Comments
 (0)