Skip to content

Commit

Permalink
fixup: rebase artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Jun 7, 2019
1 parent 94b4ead commit b7cd089
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/_pytest/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" core implementation of testing process: init, session, runtest loop. """
import fnmatch
import enum
import fnmatch
import functools
import os
import pkgutil
Expand Down Expand Up @@ -202,7 +202,7 @@ def wrap_session(config, doit):
initstate = 2
session.exitstatus = doit(config, session) or 0
except UsageError:
session.exitstatus = EXIT_USAGEERROR
session.exitstatus = ExitCode.USAGE_ERROR
raise
except Failed:
session.exitstatus = ExitCode.TESTS_FAILED
Expand Down
6 changes: 3 additions & 3 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,18 +409,18 @@ def test_a():
def test_report_all_failed_collections_initargs(self, testdir):
testdir.makeconftest(
"""
from _pytest.main import EXIT_USAGEERROR
from _pytest.main import ExitCode
def pytest_sessionfinish(exitstatus):
assert exitstatus == EXIT_USAGEERROR
assert exitstatus == ExitCode.USAGE_ERROR
print("pytest_sessionfinish_called")
"""
)
testdir.makepyfile(test_a="def", test_b="def")
result = testdir.runpytest("test_a.py::a", "test_b.py::b")
result.stderr.fnmatch_lines(["*ERROR*test_a.py::a*", "*ERROR*test_b.py::b*"])
result.stdout.fnmatch_lines(["pytest_sessionfinish_called"])
assert result.ret == EXIT_USAGEERROR
assert result.ret == ExitCode.USAGE_ERROR

@pytest.mark.usefixtures("recwarn")
def test_namespace_import_doesnt_confuse_import_hook(self, testdir):
Expand Down
4 changes: 2 additions & 2 deletions testing/test_cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import py

import pytest
from _pytest.main import EXIT_NOTESTSCOLLECTED
from _pytest.main import ExitCode

pytest_plugins = ("pytester",)

Expand Down Expand Up @@ -757,7 +757,7 @@ def test_2():
"* 2 deselected in *",
]
)
assert result.ret == EXIT_NOTESTSCOLLECTED
assert result.ret == ExitCode.NO_TESTS_COLLECTED

def test_lastfailed_no_failures_behavior_empty_cache(self, testdir):
testdir.makepyfile(
Expand Down
6 changes: 3 additions & 3 deletions testing/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def pytest_configure(config):
testdir.makepyfile(test_world="def test_hello(): pass")
testdir.makepyfile(test_welt="def test_hallo(): pass")
result = testdir.runpytest()
assert result.ret == EXIT_NOTESTSCOLLECTED
assert result.ret == ExitCode.NO_TESTS_COLLECTED
result.stdout.fnmatch_lines(["*collected 0 items*"])
result = testdir.runpytest("--XX")
assert result.ret == 0
Expand Down Expand Up @@ -1171,7 +1171,7 @@ def test_collectignore_via_conftest(testdir, monkeypatch):
ignore_me.ensure("conftest.py").write("assert 0, 'should_not_be_called'")

result = testdir.runpytest()
assert result.ret == EXIT_NOTESTSCOLLECTED
assert result.ret == ExitCode.NO_TESTS_COLLECTED


def test_collect_pkg_init_and_file_in_args(testdir):
Expand Down Expand Up @@ -1233,7 +1233,7 @@ def test_collect_sub_with_symlinks(use_pkg, testdir):
def test_collector_respects_tbstyle(testdir):
p1 = testdir.makepyfile("assert 0")
result = testdir.runpytest(p1, "--tb=native")
assert result.ret == EXIT_INTERRUPTED
assert result.ret == ExitCode.INTERRUPTED
result.stdout.fnmatch_lines(
[
"*_ ERROR collecting test_collector_respects_tbstyle.py _*",
Expand Down
17 changes: 7 additions & 10 deletions testing/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
from _pytest.config.findpaths import get_common_ancestor
from _pytest.config.findpaths import getcfg
from _pytest.main import ExitCode
from _pytest.main import EXIT_OK
from _pytest.main import EXIT_TESTSFAILED
from _pytest.main import EXIT_USAGEERROR


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

result = testdir.runpytest("--version")
result.stderr.fnmatch_lines(
["*pytest*{}*imported from*".format(pytest.__version__)]
)
assert result.ret == EXIT_USAGEERROR
assert result.ret == ExitCode.USAGE_ERROR


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

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


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

if plugin == "python":
assert result.ret == EXIT_USAGEERROR
assert result.ret == ExitCode.USAGE_ERROR
result.stderr.fnmatch_lines(
[
"ERROR: not found: */test_config_blocked_default_plugins.py",
Expand All @@ -1228,13 +1225,13 @@ def test_config_blocked_default_plugins(testdir, plugin):
)
return

assert result.ret == EXIT_OK
assert result.ret == ExitCode.OK
if plugin != "terminal":
result.stdout.fnmatch_lines(["* 1 passed in *"])

p = testdir.makepyfile("def test(): assert 0")
result = testdir.runpytest(str(p), "-pno:%s" % plugin)
assert result.ret == EXIT_TESTSFAILED
assert result.ret == ExitCode.TESTS_FAILED
if plugin != "terminal":
result.stdout.fnmatch_lines(["* 1 failed in *"])
else:
Expand Down
2 changes: 1 addition & 1 deletion testing/test_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def fixture():
build.chdir()
result = testdir.runpytest("-vs", "app/test_foo.py")
result.stdout.fnmatch_lines(["*conftest_loaded*", "PASSED"])
assert result.ret == EXIT_OK
assert result.ret == ExitCode.OK


def test_no_conftest(testdir):
Expand Down
4 changes: 2 additions & 2 deletions testing/test_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from unittest import mock

import pytest
from _pytest.main import EXIT_INTERRUPTED
from _pytest.main import ExitCode
from _pytest.mark import EMPTY_PARAMETERSET_OPTION
from _pytest.mark import MarkGenerator as Mark
from _pytest.nodes import Collector
Expand Down Expand Up @@ -903,7 +903,7 @@ def test():
"*= 1 error in *",
]
)
assert result.ret == EXIT_INTERRUPTED
assert result.ret == ExitCode.INTERRUPTED


def test_parameterset_for_parametrize_bad_markname(testdir):
Expand Down

0 comments on commit b7cd089

Please sign in to comment.