Skip to content

Commit de97bca

Browse files
authored
pytest_addoption: use group.addoption (#833)
Using `group._addoption` bypasses the check for existing options.
1 parent 203a7d6 commit de97bca

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pytest_django/plugin.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,47 +63,47 @@
6363

6464
def pytest_addoption(parser):
6565
group = parser.getgroup("django")
66-
group._addoption(
66+
group.addoption(
6767
"--reuse-db",
6868
action="store_true",
6969
dest="reuse_db",
7070
default=False,
7171
help="Re-use the testing database if it already exists, "
7272
"and do not remove it when the test finishes.",
7373
)
74-
group._addoption(
74+
group.addoption(
7575
"--create-db",
7676
action="store_true",
7777
dest="create_db",
7878
default=False,
7979
help="Re-create the database, even if it exists. This "
8080
"option can be used to override --reuse-db.",
8181
)
82-
group._addoption(
82+
group.addoption(
8383
"--ds",
8484
action="store",
8585
type=str,
8686
dest="ds",
8787
default=None,
8888
help="Set DJANGO_SETTINGS_MODULE.",
8989
)
90-
group._addoption(
90+
group.addoption(
9191
"--dc",
9292
action="store",
9393
type=str,
9494
dest="dc",
9595
default=None,
9696
help="Set DJANGO_CONFIGURATION.",
9797
)
98-
group._addoption(
98+
group.addoption(
9999
"--nomigrations",
100100
"--no-migrations",
101101
action="store_true",
102102
dest="nomigrations",
103103
default=False,
104104
help="Disable Django migrations on test setup",
105105
)
106-
group._addoption(
106+
group.addoption(
107107
"--migrations",
108108
action="store_false",
109109
dest="nomigrations",
@@ -113,7 +113,7 @@ def pytest_addoption(parser):
113113
parser.addini(
114114
CONFIGURATION_ENV, "django-configurations class to use by pytest-django."
115115
)
116-
group._addoption(
116+
group.addoption(
117117
"--liveserver",
118118
default=None,
119119
help="Address and port for the live_server fixture.",
@@ -128,7 +128,7 @@ def pytest_addoption(parser):
128128
type="bool",
129129
default=True,
130130
)
131-
group._addoption(
131+
group.addoption(
132132
"--fail-on-template-vars",
133133
action="store_true",
134134
dest="itv",

0 commit comments

Comments
 (0)