Merge default
This commit is contained in:
@@ -641,7 +641,7 @@ class TestTracebackCutting:
|
||||
assert "x = 1" not in out
|
||||
assert "x = 2" not in out
|
||||
result.stdout.fnmatch_lines([
|
||||
">*asd*",
|
||||
" *asd*",
|
||||
"E*NameError*",
|
||||
])
|
||||
result = testdir.runpytest("--fulltrace")
|
||||
|
||||
@@ -4,7 +4,6 @@ import sys
|
||||
import py, pytest
|
||||
import _pytest.assertion as plugin
|
||||
from _pytest.assertion import reinterpret
|
||||
from _pytest.assertion import util
|
||||
needsnewassert = pytest.mark.skipif("sys.version_info < (2,6)")
|
||||
|
||||
|
||||
@@ -370,7 +369,7 @@ def test_traceback_failure(testdir):
|
||||
def test_onefails():
|
||||
f(3)
|
||||
""")
|
||||
result = testdir.runpytest(p1)
|
||||
result = testdir.runpytest(p1, "--tb=long")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_traceback_failure.py F",
|
||||
"====* FAILURES *====",
|
||||
@@ -390,6 +389,25 @@ def test_traceback_failure(testdir):
|
||||
"*test_traceback_failure.py:4: AssertionError"
|
||||
])
|
||||
|
||||
result = testdir.runpytest(p1) # "auto"
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_traceback_failure.py F",
|
||||
"====* FAILURES *====",
|
||||
"____*____",
|
||||
"",
|
||||
" def test_onefails():",
|
||||
"> f(3)",
|
||||
"",
|
||||
"*test_*.py:6: ",
|
||||
"",
|
||||
" def f(x):",
|
||||
"> assert x == g()",
|
||||
"E assert 3 == 2",
|
||||
"E + where 2 = g()",
|
||||
"",
|
||||
"*test_traceback_failure.py:4: AssertionError"
|
||||
])
|
||||
|
||||
@pytest.mark.skipif("sys.version_info < (2,5) or '__pypy__' in sys.builtin_module_names or sys.platform.startswith('java')" )
|
||||
def test_warn_missing(testdir):
|
||||
testdir.makepyfile("")
|
||||
|
||||
+2
-19
@@ -65,7 +65,7 @@ class TestCaptureManager:
|
||||
assert parser._groups[0].options[0].default == "sys"
|
||||
|
||||
@needsosdup
|
||||
@pytest.mark.parametrize("method",
|
||||
@pytest.mark.parametrize("method",
|
||||
['no', 'sys', pytest.mark.skipif('not hasattr(os, "dup")', 'fd')])
|
||||
def test_capturing_basic_api(self, method):
|
||||
capouter = StdCaptureFD()
|
||||
@@ -750,7 +750,7 @@ def saved_fd(fd):
|
||||
finally:
|
||||
os.dup2(new_fd, fd)
|
||||
|
||||
|
||||
|
||||
class TestStdCapture:
|
||||
captureclass = staticmethod(StdCapture)
|
||||
|
||||
@@ -1011,20 +1011,3 @@ def test_capturing_and_logging_fundamentals(testdir, method):
|
||||
""")
|
||||
assert "atexit" not in result.stderr.str()
|
||||
|
||||
def test_close_and_capture_again(testdir):
|
||||
testdir.makepyfile("""
|
||||
import os
|
||||
def test_close():
|
||||
os.close(1)
|
||||
def test_capture_again():
|
||||
os.write(1, b"hello\\n")
|
||||
assert 0
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines("""
|
||||
*test_capture_again*
|
||||
*assert 0*
|
||||
*stdout*
|
||||
*hello*
|
||||
""")
|
||||
|
||||
|
||||
+17
-2
@@ -79,6 +79,21 @@ class TestConfigCmdlineParsing:
|
||||
config = testdir.parseconfig()
|
||||
pytest.raises(AssertionError, lambda: config.parse([]))
|
||||
|
||||
def test_explicitly_specified_config_file_is_loaded(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
def pytest_addoption(parser):
|
||||
parser.addini("custom", "")
|
||||
""")
|
||||
testdir.makeini("""
|
||||
[pytest]
|
||||
custom = 0
|
||||
""")
|
||||
testdir.makefile(".cfg", custom = """
|
||||
[pytest]
|
||||
custom = 1
|
||||
""")
|
||||
config = testdir.parseconfig("-c", "custom.cfg")
|
||||
assert config.getini("custom") == "1"
|
||||
|
||||
class TestConfigAPI:
|
||||
def test_config_trace(self, testdir):
|
||||
@@ -123,8 +138,8 @@ class TestConfigAPI:
|
||||
parser.addoption("--hello")
|
||||
""")
|
||||
config = testdir.parseconfig()
|
||||
pytest.raises(pytest.skip.Exception,
|
||||
"config.getvalueorskip('hello')")
|
||||
with pytest.raises(pytest.skip.Exception):
|
||||
config.getvalueorskip('hello')
|
||||
|
||||
def test_getoption(self, testdir):
|
||||
config = testdir.parseconfig()
|
||||
|
||||
@@ -80,6 +80,8 @@ class TestDoctests:
|
||||
assert isinstance(items[0].parent, DoctestModule)
|
||||
assert items[0].parent is items[1].parent
|
||||
|
||||
@pytest.mark.xfail('hasattr(sys, "pypy_version_info")', reason=
|
||||
"pypy leaks one FD")
|
||||
def test_simple_doctestfile(self, testdir):
|
||||
p = testdir.maketxtfile(test_doc="""
|
||||
>>> x = 1
|
||||
|
||||
@@ -494,6 +494,8 @@ def test_unicode_issue368(testdir):
|
||||
log.append_error(report)
|
||||
report.longrepr = "filename", 1, ustr
|
||||
log.append_skipped(report)
|
||||
report.longrepr = "filename", 1, "Skipped: 卡嘣嘣"
|
||||
log.append_skipped(report)
|
||||
report.wasxfail = ustr
|
||||
log.append_skipped(report)
|
||||
log.pytest_sessionfinish()
|
||||
|
||||
@@ -559,8 +559,8 @@ def test_tbstyle_short(testdir):
|
||||
assert 'x = 0' not in s
|
||||
result.stdout.fnmatch_lines([
|
||||
"*%s:5*" % p.basename,
|
||||
">*assert x",
|
||||
"E*assert*",
|
||||
" assert x",
|
||||
"E assert*",
|
||||
])
|
||||
result = testdir.runpytest()
|
||||
s = result.stdout.str()
|
||||
@@ -583,7 +583,7 @@ class TestGenericReporting:
|
||||
testdir.makepyfile("import xyz\n")
|
||||
result = testdir.runpytest(*option.args)
|
||||
result.stdout.fnmatch_lines([
|
||||
"> import xyz",
|
||||
"? import xyz",
|
||||
"E ImportError: No module named *xyz*",
|
||||
"*1 error*",
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user