Skip to content

Commit

Permalink
pytest_addoption: use group.addoption (#833)
Browse files Browse the repository at this point in the history
Using `group._addoption` bypasses the check for existing options.
  • Loading branch information
beyondgeeks committed Mar 30, 2020
1 parent 3f1cccb commit 2888eaa
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pytest_django/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,47 +63,47 @@

def pytest_addoption(parser):
group = parser.getgroup("django")
group._addoption(
group.addoption(
"--reuse-db",
action="store_true",
dest="reuse_db",
default=False,
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",
default=False,
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,
dest="ds",
default=None,
help="Set DJANGO_SETTINGS_MODULE.",
)
group._addoption(
group.addoption(
"--dc",
action="store",
type=str,
dest="dc",
default=None,
help="Set DJANGO_CONFIGURATION.",
)
group._addoption(
group.addoption(
"--nomigrations",
"--no-migrations",
action="store_true",
dest="nomigrations",
default=False,
help="Disable Django migrations on test setup",
)
group._addoption(
group.addoption(
"--migrations",
action="store_false",
dest="nomigrations",
Expand All @@ -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.",
Expand All @@ -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",
Expand Down

0 comments on commit 2888eaa

Please sign in to comment.