From 19e05c91ad0eb719ac0d4a598602c44b77e2f0a1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 28 Mar 2020 17:17:00 +0100 Subject: [PATCH 1/2] pytest_addoption: use `group.addoption` Using `group._addoption` bypasses the check for existing options. --- pytest_django/plugin.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pytest_django/plugin.py b/pytest_django/plugin.py index 5204da30c..b5d34ba14 100644 --- a/pytest_django/plugin.py +++ b/pytest_django/plugin.py @@ -63,7 +63,7 @@ def pytest_addoption(parser): group = parser.getgroup("django") - group._addoption( + group.addoption( "--reuse-db", action="store_true", dest="reuse_db", @@ -71,7 +71,7 @@ def pytest_addoption(parser): help="Re-use the testing database if it already exists, " "and do not remove it when the test finishes.", ) - group._addoption( + group.addoption( "--create-db", action="store_true", dest="create_db", @@ -79,7 +79,7 @@ def pytest_addoption(parser): help="Re-create the database, even if it exists. This " "option can be used to override --reuse-db.", ) - group._addoption( + group.addoption( "--ds", action="store", type=str, @@ -87,7 +87,7 @@ def pytest_addoption(parser): default=None, help="Set DJANGO_SETTINGS_MODULE.", ) - group._addoption( + group.addoption( "--dc", action="store", type=str, @@ -95,7 +95,7 @@ def pytest_addoption(parser): default=None, help="Set DJANGO_CONFIGURATION.", ) - group._addoption( + group.addoption( "--nomigrations", "--no-migrations", action="store_true", @@ -103,7 +103,7 @@ def pytest_addoption(parser): default=False, help="Disable Django migrations on test setup", ) - group._addoption( + group.addoption( "--migrations", action="store_false", dest="nomigrations", @@ -113,7 +113,7 @@ def pytest_addoption(parser): parser.addini( CONFIGURATION_ENV, "django-configurations class to use by pytest-django." ) - group._addoption( + group.addoption( "--liveserver", default=None, help="Address and port for the live_server fixture.", @@ -128,7 +128,7 @@ def pytest_addoption(parser): type="bool", default=True, ) - group._addoption( + group.addoption( "--fail-on-template-vars", action="store_true", dest="itv", From 7b2d1e5941c71511998504babbd24f91f82d2a24 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 29 Mar 2020 19:16:23 +0200 Subject: [PATCH 2/2] rebuild