Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions: {}

jobs:
package:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 10

steps:
Expand All @@ -24,7 +24,7 @@ jobs:
deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pytest-django'
needs: [package]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
environment: deploy
timeout-minutes: 15
permissions:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions: {}

jobs:
test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
continue-on-error: ${{ matrix.allow_failure }}
timeout-minutes: 15
permissions:
Expand Down Expand Up @@ -64,11 +64,11 @@ jobs:
matrix:
include:
- name: linting,docs
python: '3.12'
python: '3.13'
allow_failure: false

- name: py312-dj51-postgres-xdist-coverage
python: '3.12'
- name: py313-dj51-postgres-xdist-coverage
python: '3.13'
allow_failure: false

- name: py312-dj42-postgres-xdist-coverage
Expand Down Expand Up @@ -103,8 +103,8 @@ jobs:
python: '3.9'
allow_failure: false

- name: py312-djmain-sqlite-coverage
python: '3.12'
- name: py313-djmain-sqlite-coverage
python: '3.13'
allow_failure: true

- name: py312-dj51-sqlite-xdist-coverage
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
needs:
- test

runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down
14 changes: 14 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Changelog
=========

v4.10.0 (Not released yet)
--------------------------

Compatibility
^^^^^^^^^^^^^

* Added official support for Python 3.13.

Bugfixes
^^^^^^^^

* Fixed lock/unlock of db breaks if pytest is executed twice in the same process.


v4.9.0 (2024-09-02)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Testing",
Expand Down Expand Up @@ -138,7 +139,6 @@ ignore = [
"PLR0913", # Too many arguments in function definition
"PLR2004", # Magic value used in comparison, consider replacing 3 with a constant variable
"PT001", # Use `@pytest.fixture()` over `@pytest.fixture`
"PT004", # Fixture `fixture_with_db` does not return anything, add leading underscore
"PT023", # Use `@pytest.mark.django_db()` over `@pytest.mark.django_db`
]

Expand Down
2 changes: 1 addition & 1 deletion pytest_django/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@


__all__ = [
"__version__",
"DjangoAssertNumQueries",
"DjangoCaptureOnCommitCallbacks",
"DjangoDbBlocker",
"__version__",
]
24 changes: 12 additions & 12 deletions pytest_django/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@


__all__ = [
"django_db_setup",
"_live_server_helper",
"admin_client",
"admin_user",
"async_client",
"async_rf",
"client",
"db",
"transactional_db",
"django_assert_max_num_queries",
"django_assert_num_queries",
"django_capture_on_commit_callbacks",
"django_db_reset_sequences",
"django_db_serialized_rollback",
"admin_user",
"django_db_setup",
"django_user_model",
"django_username_field",
"client",
"async_client",
"admin_client",
"live_server",
"rf",
"async_rf",
"settings",
"live_server",
"_live_server_helper",
"django_assert_num_queries",
"django_assert_max_num_queries",
"django_capture_on_commit_callbacks",
"transactional_db",
]


Expand Down
4 changes: 2 additions & 2 deletions pytest_django/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ def pytest_addoption(parser: pytest.Parser) -> None:

parser.addini(
"django_find_project",
"Automatically find and add a Django project to the " "Python path.",
"Automatically find and add a Django project to the Python path.",
type="bool",
default=True,
)
parser.addini(
"django_debug_mode",
"How to set the Django DEBUG setting (default `False`). " "Use `keep` to not override.",
"How to set the Django DEBUG setting (default `False`). Use `keep` to not override.",
default="False",
)
group.addoption(
Expand Down
4 changes: 0 additions & 4 deletions setup.py

This file was deleted.

9 changes: 4 additions & 5 deletions tests/test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_django_assert_num_queries_db(
with django_assert_num_queries(2) as captured:
Item.objects.create(name="quux")
assert excinfo.value.args == (
"Expected to perform 2 queries but 1 was done " "(add -v option to show queries)",
"Expected to perform 2 queries but 1 was done (add -v option to show queries)",
)
assert len(captured.captured_queries) == 1

Expand Down Expand Up @@ -556,11 +556,10 @@ def test_specified_port_django_111(self, django_pytester: DjangoPytester) -> Non
sock.close()

django_pytester.create_test_module(
f"""
def test_with_live_server(live_server):
assert live_server.port == {port}
"""
def test_with_live_server(live_server):
assert live_server.port == %d
"""
% port
)

django_pytester.runpytest_subprocess(f"--liveserver=localhost:{port}")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_manage_py_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_django_project_scan_disabled_invalid_settings(
assert result.ret != 0

result.stderr.fnmatch_lines(["*ImportError*DOES_NOT_EXIST*"])
result.stderr.fnmatch_lines(["*pytest-django did not search for " "Django projects*"])
result.stderr.fnmatch_lines(["*pytest-django did not search for Django projects*"])


@pytest.mark.django_project(project_root="django_project_root", create_manage_py=True)
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[tox]
envlist =
py313-dj{main,51}-postgres
py312-dj{main,51,50,42}-postgres
py311-dj{main,51,50,42}-postgres
py310-dj{main,51,50,42}-postgres
Expand Down Expand Up @@ -49,8 +50,8 @@ commands =
[testenv:linting]
extras =
deps =
ruff==0.6.3
mypy==1.11.2
ruff==0.9.5
mypy==1.15.0
commands =
ruff check {posargs:pytest_django pytest_django_test tests}
ruff format --quiet --diff {posargs:pytest_django pytest_django_test tests}
Expand Down