Merge branch 'master' into merge-master
This commit is contained in:
commit
eab762ea99
2
AUTHORS
2
AUTHORS
|
@ -49,6 +49,7 @@ Jaap Broekhuizen
|
|||
Jan Balster
|
||||
Janne Vanhala
|
||||
Jason R. Coombs
|
||||
John Towler
|
||||
Joshua Bronson
|
||||
Jurko Gospodnetić
|
||||
Katarzyna Jachim
|
||||
|
@ -93,3 +94,4 @@ Russel Winder
|
|||
Ben Webb
|
||||
Alexei Kozlenok
|
||||
Cal Leeming
|
||||
Feng Ma
|
||||
|
|
|
@ -75,7 +75,8 @@
|
|||
|
||||
* When receiving identical test ids in parametrize we generate unique test ids.
|
||||
|
||||
*
|
||||
* Fix win32 path issue when puttinging custom config file with absolute path
|
||||
in ``pytest.main("-c your_absolute_path")``.
|
||||
|
||||
* Fix maximum recursion depth detection when raised error class is not aware
|
||||
of unicode/encoded bytes.
|
||||
|
|
|
@ -305,11 +305,11 @@ class Traceback(list):
|
|||
def filter(self, fn=lambda x: not x.ishidden()):
|
||||
""" return a Traceback instance with certain items removed
|
||||
|
||||
fn is a function that gets a single argument, a TracebackItem
|
||||
fn is a function that gets a single argument, a TracebackEntry
|
||||
instance, and should return True when the item should be added
|
||||
to the Traceback, False when not
|
||||
|
||||
by default this removes all the TracebackItems which are hidden
|
||||
by default this removes all the TracebackEntries which are hidden
|
||||
(see ishidden() above)
|
||||
"""
|
||||
return Traceback(filter(fn, self), self._excinfo)
|
||||
|
@ -325,7 +325,7 @@ class Traceback(list):
|
|||
return self[-1]
|
||||
|
||||
def recursionindex(self):
|
||||
""" return the index of the frame/TracebackItem where recursion
|
||||
""" return the index of the frame/TracebackEntry where recursion
|
||||
originates if appropriate, None if no recursion occurred
|
||||
"""
|
||||
cache = {}
|
||||
|
|
|
@ -104,7 +104,7 @@ def _prepareconfig(args=None, plugins=None):
|
|||
elif not isinstance(args, (tuple, list)):
|
||||
if not isinstance(args, str):
|
||||
raise ValueError("not a string or argument list: %r" % (args,))
|
||||
args = shlex.split(args)
|
||||
args = shlex.split(args, posix=sys.platform == "win32")
|
||||
config = get_config()
|
||||
pluginmanager = config.pluginmanager
|
||||
try:
|
||||
|
|
|
@ -373,7 +373,7 @@ class LogXML(object):
|
|||
suite_stop_time = time.time()
|
||||
suite_time_delta = suite_stop_time - self.suite_start_time
|
||||
|
||||
numtests = self.stats['passed'] + self.stats['failure']
|
||||
numtests = self.stats['passed'] + self.stats['failure'] + self.stats['skipped']
|
||||
|
||||
logfile.write('<?xml version="1.0" encoding="utf-8"?>')
|
||||
|
||||
|
|
|
@ -1746,7 +1746,7 @@ class FixtureRequest(FuncargnamesCompatAttr):
|
|||
self._pyfuncitem = pyfuncitem
|
||||
#: fixture for which this request is being performed
|
||||
self.fixturename = None
|
||||
#: Scope string, one of "function", "cls", "module", "session"
|
||||
#: Scope string, one of "function", "class", "module", "session"
|
||||
self.scope = "function"
|
||||
self._funcargs = {}
|
||||
self._fixturedefs = {}
|
||||
|
|
|
@ -9,19 +9,19 @@ by passing the ``--ignore=path`` option on the cli. ``pytest`` allows multiple
|
|||
``--ignore`` options. Example::
|
||||
|
||||
tests/
|
||||
├── example
|
||||
│ ├── test_example_01.py
|
||||
│ ├── test_example_02.py
|
||||
│ └── test_example_03.py
|
||||
├── foobar
|
||||
│ ├── test_foobar_01.py
|
||||
│ ├── test_foobar_02.py
|
||||
│ └── test_foobar_03.py
|
||||
└── hello
|
||||
└── world
|
||||
├── test_world_01.py
|
||||
├── test_world_02.py
|
||||
└── test_world_03.py
|
||||
|-- example
|
||||
| |-- test_example_01.py
|
||||
| |-- test_example_02.py
|
||||
| '-- test_example_03.py
|
||||
|-- foobar
|
||||
| |-- test_foobar_01.py
|
||||
| |-- test_foobar_02.py
|
||||
| '-- test_foobar_03.py
|
||||
'-- hello
|
||||
'-- world
|
||||
|-- test_world_01.py
|
||||
|-- test_world_02.py
|
||||
'-- test_world_03.py
|
||||
|
||||
Now if you invoke ``pytest`` with ``--ignore=tests/foobar/test_foobar_03.py --ignore=tests/hello/``,
|
||||
you will see that ``pytest`` only collects test-modules, which do not match the patterns specified::
|
||||
|
|
|
@ -79,7 +79,7 @@ class TestParseIni:
|
|||
""")
|
||||
result = testdir.inline_run("--confcutdir=.")
|
||||
assert result.ret == 0
|
||||
|
||||
|
||||
class TestConfigCmdlineParsing:
|
||||
def test_parsing_again_fails(self, testdir):
|
||||
config = testdir.parseconfig()
|
||||
|
@ -101,6 +101,16 @@ class TestConfigCmdlineParsing:
|
|||
config = testdir.parseconfig("-c", "custom.cfg")
|
||||
assert config.getini("custom") == "1"
|
||||
|
||||
def test_absolute_win32_path(self, testdir):
|
||||
temp_cfg_file = testdir.makefile(".cfg", custom="""
|
||||
[pytest]
|
||||
addopts = --version
|
||||
""")
|
||||
from os.path import normpath
|
||||
temp_cfg_file = normpath(str(temp_cfg_file))
|
||||
ret = pytest.main("-c " + temp_cfg_file)
|
||||
assert ret == _pytest.main.EXIT_OK
|
||||
|
||||
class TestConfigAPI:
|
||||
def test_config_trace(self, testdir):
|
||||
config = testdir.parseconfig()
|
||||
|
|
|
@ -100,7 +100,7 @@ class TestPython:
|
|||
result, dom = runandparse(testdir)
|
||||
assert result.ret
|
||||
node = dom.find_first_by_tag("testsuite")
|
||||
node.assert_attr(name="pytest", errors=0, failures=1, skips=3, tests=2)
|
||||
node.assert_attr(name="pytest", errors=0, failures=1, skips=3, tests=5)
|
||||
|
||||
def test_timing_function(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
|
@ -304,7 +304,7 @@ class TestPython:
|
|||
result, dom = runandparse(testdir)
|
||||
assert not result.ret
|
||||
node = dom.find_first_by_tag("testsuite")
|
||||
node.assert_attr(skips=1, tests=0)
|
||||
node.assert_attr(skips=1, tests=1)
|
||||
tnode = node.find_first_by_tag("testcase")
|
||||
tnode.assert_attr(
|
||||
file="test_xfailure_function.py",
|
||||
|
@ -325,7 +325,7 @@ class TestPython:
|
|||
result, dom = runandparse(testdir)
|
||||
# assert result.ret
|
||||
node = dom.find_first_by_tag("testsuite")
|
||||
node.assert_attr(skips=1, tests=0)
|
||||
node.assert_attr(skips=1, tests=1)
|
||||
tnode = node.find_first_by_tag("testcase")
|
||||
tnode.assert_attr(
|
||||
file="test_xfailure_xpass.py",
|
||||
|
@ -356,7 +356,7 @@ class TestPython:
|
|||
result, dom = runandparse(testdir)
|
||||
assert result.ret == EXIT_NOTESTSCOLLECTED
|
||||
node = dom.find_first_by_tag("testsuite")
|
||||
node.assert_attr(skips=1, tests=0)
|
||||
node.assert_attr(skips=1, tests=1)
|
||||
tnode = node.find_first_by_tag("testcase")
|
||||
tnode.assert_attr(
|
||||
file="test_collect_skipped.py",
|
||||
|
|
Loading…
Reference in New Issue