Skip to content

Commit b7cd089

Browse files
fixup: rebase artifacts
1 parent 94b4ead commit b7cd089

File tree

7 files changed

+20
-23
lines changed

7 files changed

+20
-23
lines changed

src/_pytest/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
""" core implementation of testing process: init, session, runtest loop. """
2-
import fnmatch
32
import enum
3+
import fnmatch
44
import functools
55
import os
66
import pkgutil
@@ -202,7 +202,7 @@ def wrap_session(config, doit):
202202
initstate = 2
203203
session.exitstatus = doit(config, session) or 0
204204
except UsageError:
205-
session.exitstatus = EXIT_USAGEERROR
205+
session.exitstatus = ExitCode.USAGE_ERROR
206206
raise
207207
except Failed:
208208
session.exitstatus = ExitCode.TESTS_FAILED

testing/acceptance_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,18 +409,18 @@ def test_a():
409409
def test_report_all_failed_collections_initargs(self, testdir):
410410
testdir.makeconftest(
411411
"""
412-
from _pytest.main import EXIT_USAGEERROR
412+
from _pytest.main import ExitCode
413413
414414
def pytest_sessionfinish(exitstatus):
415-
assert exitstatus == EXIT_USAGEERROR
415+
assert exitstatus == ExitCode.USAGE_ERROR
416416
print("pytest_sessionfinish_called")
417417
"""
418418
)
419419
testdir.makepyfile(test_a="def", test_b="def")
420420
result = testdir.runpytest("test_a.py::a", "test_b.py::b")
421421
result.stderr.fnmatch_lines(["*ERROR*test_a.py::a*", "*ERROR*test_b.py::b*"])
422422
result.stdout.fnmatch_lines(["pytest_sessionfinish_called"])
423-
assert result.ret == EXIT_USAGEERROR
423+
assert result.ret == ExitCode.USAGE_ERROR
424424

425425
@pytest.mark.usefixtures("recwarn")
426426
def test_namespace_import_doesnt_confuse_import_hook(self, testdir):

testing/test_cacheprovider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import py
77

88
import pytest
9-
from _pytest.main import EXIT_NOTESTSCOLLECTED
9+
from _pytest.main import ExitCode
1010

1111
pytest_plugins = ("pytester",)
1212

@@ -757,7 +757,7 @@ def test_2():
757757
"* 2 deselected in *",
758758
]
759759
)
760-
assert result.ret == EXIT_NOTESTSCOLLECTED
760+
assert result.ret == ExitCode.NO_TESTS_COLLECTED
761761

762762
def test_lastfailed_no_failures_behavior_empty_cache(self, testdir):
763763
testdir.makepyfile(

testing/test_collection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def pytest_configure(config):
383383
testdir.makepyfile(test_world="def test_hello(): pass")
384384
testdir.makepyfile(test_welt="def test_hallo(): pass")
385385
result = testdir.runpytest()
386-
assert result.ret == EXIT_NOTESTSCOLLECTED
386+
assert result.ret == ExitCode.NO_TESTS_COLLECTED
387387
result.stdout.fnmatch_lines(["*collected 0 items*"])
388388
result = testdir.runpytest("--XX")
389389
assert result.ret == 0
@@ -1171,7 +1171,7 @@ def test_collectignore_via_conftest(testdir, monkeypatch):
11711171
ignore_me.ensure("conftest.py").write("assert 0, 'should_not_be_called'")
11721172

11731173
result = testdir.runpytest()
1174-
assert result.ret == EXIT_NOTESTSCOLLECTED
1174+
assert result.ret == ExitCode.NO_TESTS_COLLECTED
11751175

11761176

11771177
def test_collect_pkg_init_and_file_in_args(testdir):
@@ -1233,7 +1233,7 @@ def test_collect_sub_with_symlinks(use_pkg, testdir):
12331233
def test_collector_respects_tbstyle(testdir):
12341234
p1 = testdir.makepyfile("assert 0")
12351235
result = testdir.runpytest(p1, "--tb=native")
1236-
assert result.ret == EXIT_INTERRUPTED
1236+
assert result.ret == ExitCode.INTERRUPTED
12371237
result.stdout.fnmatch_lines(
12381238
[
12391239
"*_ ERROR collecting test_collector_respects_tbstyle.py _*",

testing/test_config.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
from _pytest.config.findpaths import get_common_ancestor
1212
from _pytest.config.findpaths import getcfg
1313
from _pytest.main import ExitCode
14-
from _pytest.main import EXIT_OK
15-
from _pytest.main import EXIT_TESTSFAILED
16-
from _pytest.main import EXIT_USAGEERROR
1714

1815

1916
class TestParseIni:
@@ -1175,25 +1172,25 @@ def pytest_addoption(parser):
11751172
)
11761173
# Does not display full/default help.
11771174
assert "to see available markers type: pytest --markers" not in result.stdout.lines
1178-
assert result.ret == EXIT_USAGEERROR
1175+
assert result.ret == ExitCode.USAGE_ERROR
11791176

11801177
result = testdir.runpytest("--version")
11811178
result.stderr.fnmatch_lines(
11821179
["*pytest*{}*imported from*".format(pytest.__version__)]
11831180
)
1184-
assert result.ret == EXIT_USAGEERROR
1181+
assert result.ret == ExitCode.USAGE_ERROR
11851182

11861183

11871184
def test_config_does_not_load_blocked_plugin_from_args(testdir):
11881185
"""This tests that pytest's config setup handles "-p no:X"."""
11891186
p = testdir.makepyfile("def test(capfd): pass")
11901187
result = testdir.runpytest(str(p), "-pno:capture")
11911188
result.stdout.fnmatch_lines(["E fixture 'capfd' not found"])
1192-
assert result.ret == EXIT_TESTSFAILED
1189+
assert result.ret == ExitCode.TESTS_FAILED
11931190

11941191
result = testdir.runpytest(str(p), "-pno:capture", "-s")
11951192
result.stderr.fnmatch_lines(["*: error: unrecognized arguments: -s"])
1196-
assert result.ret == EXIT_USAGEERROR
1193+
assert result.ret == ExitCode.USAGE_ERROR
11971194

11981195

11991196
@pytest.mark.parametrize(
@@ -1219,7 +1216,7 @@ def test_config_blocked_default_plugins(testdir, plugin):
12191216
result = testdir.runpytest(str(p), "-pno:%s" % plugin)
12201217

12211218
if plugin == "python":
1222-
assert result.ret == EXIT_USAGEERROR
1219+
assert result.ret == ExitCode.USAGE_ERROR
12231220
result.stderr.fnmatch_lines(
12241221
[
12251222
"ERROR: not found: */test_config_blocked_default_plugins.py",
@@ -1228,13 +1225,13 @@ def test_config_blocked_default_plugins(testdir, plugin):
12281225
)
12291226
return
12301227

1231-
assert result.ret == EXIT_OK
1228+
assert result.ret == ExitCode.OK
12321229
if plugin != "terminal":
12331230
result.stdout.fnmatch_lines(["* 1 passed in *"])
12341231

12351232
p = testdir.makepyfile("def test(): assert 0")
12361233
result = testdir.runpytest(str(p), "-pno:%s" % plugin)
1237-
assert result.ret == EXIT_TESTSFAILED
1234+
assert result.ret == ExitCode.TESTS_FAILED
12381235
if plugin != "terminal":
12391236
result.stdout.fnmatch_lines(["* 1 failed in *"])
12401237
else:

testing/test_conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def fixture():
272272
build.chdir()
273273
result = testdir.runpytest("-vs", "app/test_foo.py")
274274
result.stdout.fnmatch_lines(["*conftest_loaded*", "PASSED"])
275-
assert result.ret == EXIT_OK
275+
assert result.ret == ExitCode.OK
276276

277277

278278
def test_no_conftest(testdir):

testing/test_mark.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from unittest import mock
44

55
import pytest
6-
from _pytest.main import EXIT_INTERRUPTED
6+
from _pytest.main import ExitCode
77
from _pytest.mark import EMPTY_PARAMETERSET_OPTION
88
from _pytest.mark import MarkGenerator as Mark
99
from _pytest.nodes import Collector
@@ -903,7 +903,7 @@ def test():
903903
"*= 1 error in *",
904904
]
905905
)
906-
assert result.ret == EXIT_INTERRUPTED
906+
assert result.ret == ExitCode.INTERRUPTED
907907

908908

909909
def test_parameterset_for_parametrize_bad_markname(testdir):

0 commit comments

Comments
 (0)