Skip to content

Commit

Permalink
Run the test suite against Mongomock
Browse files Browse the repository at this point in the history
See: #1083
Closes: #1081
  • Loading branch information
rbarrois committed Aug 18, 2024
1 parent f8456f5 commit bd6a086
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ jobs:
- "postgres"

services:
mongodb:
image: mongo
ports:
- 27017:27017

postgresdb:
image: postgres:alpine
ports:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ test:
-b \
-X dev \
-Werror \
-Wignore:::mongomock: \
-Wignore:::mongomock.__version__: \
-Wignore:::pkg_resources: \
-m unittest

# DOC: Test the examples
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ChangeLog
- Add support for Django 5.0
- Add support for Python 3.12
- :issue:`903`: Add basic typing annotations
- Run the test suite against ``mongomock`` instead of an actual mongo server

*Bugfix:*

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dev =
SQLAlchemy
sqlalchemy_utils
mongoengine
mongomock
wheel>=0.32.0
tox
zest.releaser[recommended]
Expand Down
2 changes: 2 additions & 0 deletions tests/test_mongoengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import factory
from factory.mongoengine import MongoEngineFactory
import mongomock


class Address(mongoengine.EmbeddedDocument):
Expand Down Expand Up @@ -52,6 +53,7 @@ def setUpClass(cls):
db=cls.db_name,
host=cls.db_host,
port=cls.db_port,
mongo_client_class=mongomock.MongoClient,
# PyMongo>=2.1 requires an explicit read_preference.
read_preference=mongo_rp.ReadPreference.PRIMARY,
# PyMongo>=2.1 has a 20s timeout, use 100ms instead
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ DATABASE_TYPE =

[testenv]
passenv =
MONGO_HOST
POSTGRES_HOST
POSTGRES_DATABASE
deps =
mypy
alchemy: SQLAlchemy
alchemy: sqlalchemy_utils
mongo: mongoengine
mongo: mongomock
django{32,42,50,main}: Pillow
django32: Django>=3.2,<3.3
django42: Django>=4.2,<5.0
Expand Down

0 comments on commit bd6a086

Please sign in to comment.