Skip to content

Commit 2a05c31

Browse files
implement exitfirst as store_const option
this makes it possible to override with a later maxfail
1 parent bcc58ec commit 2a05c31

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

_pytest/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def pytest_addoption(parser):
3434
# "**/test_*.py", "**/*_test.py"]
3535
#)
3636
group = parser.getgroup("general", "running and selection options")
37-
group._addoption('-x', '--exitfirst', action="store_true", default=False,
38-
dest="exitfirst",
37+
group._addoption('-x', '--exitfirst', action="store_const",
38+
dest="maxfail", const=1,
3939
help="exit instantly on first error or failed test."),
4040
group._addoption('--maxfail', metavar="num",
4141
action="store", type=int, dest="maxfail", default=0,
@@ -74,10 +74,10 @@ def pytest_namespace():
7474
collect = dict(Item=Item, Collector=Collector, File=File, Session=Session)
7575
return dict(collect=collect)
7676

77+
7778
def pytest_configure(config):
7879
pytest.config = config # compatibiltiy
79-
if config.option.exitfirst:
80-
config.option.maxfail = 1
80+
8181

8282
def wrap_session(config, doit):
8383
"""Skeleton command line program"""

0 commit comments

Comments
 (0)