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
1 change: 1 addition & 0 deletions pytest_django_test/settings_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"TEST": {
"CHARSET": "utf8mb4",
"COLLATION": "utf8mb4_unicode_ci",
"DEPENDENCIES": [],
},
},
}
3 changes: 3 additions & 0 deletions pytest_django_test/settings_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
"USER": environ.get("TEST_DB_USER", ""),
"PASSWORD": environ.get("TEST_DB_PASSWORD", ""),
"HOST": environ.get("TEST_DB_HOST", ""),
"TEST": {
"DEPENDENCIES": [],
},
},
}
3 changes: 3 additions & 0 deletions pytest_django_test/settings_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
"second": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
"TEST": {
"DEPENDENCIES": [],
},
},
}
1 change: 1 addition & 0 deletions pytest_django_test/settings_sqlite_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"NAME": "/pytest_django_tests_second",
"TEST": {
"NAME": _filename_second,
"DEPENDENCIES": [],
},
},
}
5 changes: 5 additions & 0 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ def test_not_allowed_database(self) -> None:
with pytest.raises(AssertionError, match="not allowed"):
SecondItem.objects.create(name="spam")

@pytest.mark.django_db(databases=["second"])
def test_not_allowed_database_non_default(self) -> None:
with pytest.raises(AssertionError, match="not allowed"):
Item.objects.create(name="spam")

@pytest.mark.django_db(databases=["replica"])
def test_replica_database(self) -> None:
Item.objects.using("replica").count()
Expand Down