Skip to content

Commit

Permalink
Merge pull request #13 from idoshr/mongoengine_29_1
Browse files Browse the repository at this point in the history
mongoengine 29
  • Loading branch information
idoshr authored Nov 3, 2024
2 parents 11c6ef8 + ec1c727 commit d527938
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
strategy:
fail-fast: false
matrix:
mongodb-version: ["4.0", "4.2", "4.4", "5.0", "6.0", "7.0"]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
mongodb-version: ["4.4", "5.0", "6.0", "7.0", "8.0"]
python: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions example_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class AllFieldsModel(db.Document):
file_field = db.FileField()
float_field = db.FloatField()
int_field = db.IntField()
list_field = db.ListField(field=db.StringField)
list_field = db.ListField(field=db.StringField())
reference_field = db.ReferenceField(document_type=Todo)
sorted_list_field = db.SortedListField(field=db.StringField)
sorted_list_field = db.SortedListField(field=db.StringField())
string_field = db.StringField()
url_field = db.URLField()
cached_reference_field = db.CachedReferenceField(document_type=Todo)
Expand Down
6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def lint(session):
session.run("pre-commit", "run", "-a")


@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
@nox.parametrize("flask", ["==1.1.4", "==2.0.3", "==2.3.3", ">=3.0.0"])
@nox.parametrize("mongoengine", ["==0.21.0", "==0.22.1", "==0.23.1", ">=0.24.1"])
@nox.parametrize("toolbar", [True, False])
Expand Down Expand Up @@ -86,7 +86,7 @@ def _run_in_docker(session, db_version="5.0"):
session.run_always("docker", "rm", "-fv", "nox_docker_test", external=True)


@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
@nox.parametrize("flask", ["==1.1.4", "==2.0.3", "==2.3.3", ">=3.0.0"])
@nox.parametrize("mongoengine", ["==0.21.0", "==0.22.1", "==0.23.1", ">=0.24.1"])
@nox.parametrize("toolbar", [True, False])
Expand All @@ -98,7 +98,7 @@ def full_tests(session, flask, mongoengine, toolbar, wtf, db_version):
_run_in_docker(session, db_version)


@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
@nox.parametrize("toolbar", [True, False])
@nox.parametrize("wtf", [True, False])
@nox.parametrize("db_version", ["5.0", "6.0", "7.0"])
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
Expand Down Expand Up @@ -54,7 +53,7 @@ wtf = ["WTForms[email]>=3.0.0",
]
toolbar = ["Flask-DebugToolbar>=0.11.0"]
dev = [
"black==24.10.0",
"black==24.8.0",
"pre-commit",
"pytest",
"pytest-cov",
Expand Down Expand Up @@ -101,7 +100,7 @@ write_to = "flask_mongoengine/_version.py"

[tool.black]
line-length = 88
target-version = ['py38']
target-version = ['py310']
exclude = '''
/(
\.eggs
Expand Down
12 changes: 7 additions & 5 deletions tests/test_debug_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ def test__normal_command__logged(self, py_db, registered_monitoring):

def test__failed_command_logged__logged(self, py_db, registered_monitoring):
"""Failed command index 1 in provided test."""
pymongo.collection.Collection(py_db, "test", create=True)
col = pymongo.collection.Collection(py_db, "test", create=True)
with contextlib.suppress(OperationFailure):
pymongo.collection.Collection(py_db, "test", create=True)
col.create_index([["_id", -1]], name="foo")
assert registered_monitoring.started_operations_count == 2
assert registered_monitoring.succeeded_operations_count == 1
assert registered_monitoring.failed_operations_count == 1
Expand All @@ -244,11 +244,13 @@ def test__failed_command_logged__logged(self, py_db, registered_monitoring):
assert registered_monitoring.queries[1].size >= 0
assert registered_monitoring.queries[1].database == "pymongo_test_database"
assert registered_monitoring.queries[1].collection == "test"
assert registered_monitoring.queries[1].command_name == "create"
assert registered_monitoring.queries[1].command_name == "createIndexes"
assert isinstance(registered_monitoring.queries[1].operation_id, int)
assert registered_monitoring.queries[1].server_command["create"] == "test"
assert (
"already exists"
registered_monitoring.queries[1].server_command["createIndexes"] == "test"
)
assert (
"_id index must be {_id: 1}"
in registered_monitoring.queries[1].server_response["errmsg"]
)
assert registered_monitoring.queries[1].request_status == "Failed"
4 changes: 2 additions & 2 deletions tests/test_forms_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ class AllFieldsModel(db.Document):
file_field = db.FileField()
float_field = db.FloatField()
int_field = db.IntField()
list_field = db.ListField(field=db.StringField)
list_field = db.ListField(field=db.StringField())
reference_field = db.ReferenceField(document_type=Todo)
sorted_list_field = db.SortedListField(field=db.StringField)
sorted_list_field = db.SortedListField(field=db.StringField())
string_field = db.StringField()
url_field = db.URLField()
cached_reference_field = db.CachedReferenceField(document_type=Todo)
Expand Down

0 comments on commit d527938

Please sign in to comment.