Skip to content

Commit

Permalink
Add Django 5.0 to test matrix (fixes #704)
Browse files Browse the repository at this point in the history
- timezone information is now on by default, and serilizers are expecting zulu time.
- Replace manual timestamp truncation with datetime timespec set to milliseconds
  • Loading branch information
JeremyLWright authored and adamghill committed Jul 28, 2024
1 parent b67eec7 commit 01396c3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
4 changes: 1 addition & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@


@nox.session()
@nox.parametrize("django", ["4.1", "4.2"])
def tests(session, django):
def tests(session):
session.install("poetry")
session.run("poetry", "install", "-E", "minify")
session.install(f"django=={django}")
session.run("pytest", "-m", "not slow")
session.run("pytest", "-m", "slow")
38 changes: 29 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ keywords = ["django", "python", "javascript", "fullstack"]

[tool.poetry.dependencies]
python = ">=3.8,<4"
django = ">=2.2"
django = [{version = "<=5.0", python = "<3.10"},
{version = "^5.0", python=">=3.10"}]
beautifulsoup4 = ">=4.8.0"
orjson = ">=3.6.0"
shortuuid = ">=1.0.1"
Expand Down
6 changes: 3 additions & 3 deletions tests/serializer/test_dumps.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_complicated_model():

expected = {
"date": str(model.date),
"datetime": model.datetime.isoformat()[:-3],
"datetime": model.datetime.isoformat(timespec="milliseconds").replace("+00:00", "Z"),
"decimal_value": "0.984",
"duration": "-1 19:00:00",
"float_value": "0.583",
Expand Down Expand Up @@ -195,7 +195,7 @@ def test_subclass_complicated_model():
"subclass_name": "def",
"pk": 2,
"name": "abc",
"datetime": model.datetime.isoformat()[:-3],
"datetime": model.datetime.isoformat(timespec="milliseconds").replace("+00:00", "Z"),
"float_value": "0.583",
"decimal_value": "0.984",
"uuid": str(model.uuid),
Expand Down Expand Up @@ -231,7 +231,7 @@ def test_model_with_timedelta(db): # noqa: ARG001
"decimal_value": None,
"uuid": str(flavor.uuid),
"date": str(now_dt.date()),
"datetime": now_dt.isoformat()[:-3],
"datetime": now_dt.isoformat(timespec="milliseconds").replace("+00:00", "Z"),
"time": str(now_dt.time())[:-3],
"duration": "-1 19:00:00",
"pk": 8,
Expand Down

0 comments on commit 01396c3

Please sign in to comment.