commit
9c809f5ad0
|
@ -2404,7 +2404,7 @@ Bug fixes:
|
||||||
teardown function are called earlier.
|
teardown function are called earlier.
|
||||||
- add an all-powerful metafunc.parametrize function which allows to
|
- add an all-powerful metafunc.parametrize function which allows to
|
||||||
parametrize test function arguments in multiple steps and therefore
|
parametrize test function arguments in multiple steps and therefore
|
||||||
from indepdenent plugins and palces.
|
from independent plugins and places.
|
||||||
- add a @pytest.mark.parametrize helper which allows to easily
|
- add a @pytest.mark.parametrize helper which allows to easily
|
||||||
call a test function with different argument values
|
call a test function with different argument values
|
||||||
- Add examples to the "parametrize" example page, including a quick port
|
- Add examples to the "parametrize" example page, including a quick port
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""
|
"""
|
||||||
merged implementation of the cache provider
|
merged implementation of the cache provider
|
||||||
|
|
||||||
the name cache was not choosen to ensure pluggy automatically
|
the name cache was not chosen to ensure pluggy automatically
|
||||||
ignores the external pytest-cache
|
ignores the external pytest-cache
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,7 @@ def pytest_assertrepr_compare(config, op, left, right):
|
||||||
Return None for no custom explanation, otherwise return a list
|
Return None for no custom explanation, otherwise return a list
|
||||||
of strings. The strings will be joined by newlines but any newlines
|
of strings. The strings will be joined by newlines but any newlines
|
||||||
*in* a string will be escaped. Note that all but the first line will
|
*in* a string will be escaped. Note that all but the first line will
|
||||||
be indented sligthly, the intention is for the first line to be a summary.
|
be indented slightly, the intention is for the first line to be a summary.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
|
@ -81,7 +81,7 @@ def pytest_namespace():
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
pytest.config = config # compatibiltiy
|
pytest.config = config # compatibility
|
||||||
|
|
||||||
|
|
||||||
def wrap_session(config, doit):
|
def wrap_session(config, doit):
|
||||||
|
|
|
@ -66,7 +66,7 @@ def pytest_collection_modifyitems(items, config):
|
||||||
return
|
return
|
||||||
# pytest used to allow "-" for negating
|
# pytest used to allow "-" for negating
|
||||||
# but today we just allow "-" at the beginning, use "not" instead
|
# but today we just allow "-" at the beginning, use "not" instead
|
||||||
# we probably remove "-" alltogether soon
|
# we probably remove "-" altogether soon
|
||||||
if keywordexpr.startswith("-"):
|
if keywordexpr.startswith("-"):
|
||||||
keywordexpr = "not " + keywordexpr[1:]
|
keywordexpr = "not " + keywordexpr[1:]
|
||||||
selectuntil = False
|
selectuntil = False
|
||||||
|
|
|
@ -566,7 +566,7 @@ class Testdir:
|
||||||
def mkpydir(self, name):
|
def mkpydir(self, name):
|
||||||
"""Create a new python package.
|
"""Create a new python package.
|
||||||
|
|
||||||
This creates a (sub)direcotry with an empty ``__init__.py``
|
This creates a (sub)directory with an empty ``__init__.py``
|
||||||
file so that is recognised as a python package.
|
file so that is recognised as a python package.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -661,7 +661,7 @@ class Testdir:
|
||||||
def inline_genitems(self, *args):
|
def inline_genitems(self, *args):
|
||||||
"""Run ``pytest.main(['--collectonly'])`` in-process.
|
"""Run ``pytest.main(['--collectonly'])`` in-process.
|
||||||
|
|
||||||
Retuns a tuple of the collected items and a
|
Returns a tuple of the collected items and a
|
||||||
:py:class:`HookRecorder` instance.
|
:py:class:`HookRecorder` instance.
|
||||||
|
|
||||||
This runs the :py:func:`pytest.main` function to run all of
|
This runs the :py:func:`pytest.main` function to run all of
|
||||||
|
@ -857,7 +857,7 @@ class Testdir:
|
||||||
:py:meth:`parseconfigure`.
|
:py:meth:`parseconfigure`.
|
||||||
|
|
||||||
:param withinit: Whether to also write a ``__init__.py`` file
|
:param withinit: Whether to also write a ``__init__.py`` file
|
||||||
to the temporarly directory to ensure it is a package.
|
to the temporary directory to ensure it is a package.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
kw = {self.request.function.__name__: Source(source).strip()}
|
kw = {self.request.function.__name__: Source(source).strip()}
|
||||||
|
|
|
@ -629,7 +629,7 @@ class Generator(FunctionMixin, PyCollector):
|
||||||
def getcallargs(self, obj):
|
def getcallargs(self, obj):
|
||||||
if not isinstance(obj, (tuple, list)):
|
if not isinstance(obj, (tuple, list)):
|
||||||
obj = (obj,)
|
obj = (obj,)
|
||||||
# explict naming
|
# explicit naming
|
||||||
if isinstance(obj[0], py.builtin._basestring):
|
if isinstance(obj[0], py.builtin._basestring):
|
||||||
name = obj[0]
|
name = obj[0]
|
||||||
obj = obj[1:]
|
obj = obj[1:]
|
||||||
|
|
|
@ -5,7 +5,7 @@ import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
# for transfering markers
|
# for transferring markers
|
||||||
import _pytest._code
|
import _pytest._code
|
||||||
from _pytest.python import transfer_markers
|
from _pytest.python import transfer_markers
|
||||||
from _pytest.skipping import MarkEvaluator
|
from _pytest.skipping import MarkEvaluator
|
||||||
|
|
|
@ -364,7 +364,7 @@ class TestAssert_reprcompare:
|
||||||
expl = '\n'.join(callequal(left, right, verbose=True))
|
expl = '\n'.join(callequal(left, right, verbose=True))
|
||||||
assert expl.endswith(textwrap.dedent(expected).strip())
|
assert expl.endswith(textwrap.dedent(expected).strip())
|
||||||
|
|
||||||
def test_list_different_lenghts(self):
|
def test_list_different_lengths(self):
|
||||||
expl = callequal([0, 1], [0, 1, 2])
|
expl = callequal([0, 1], [0, 1, 2])
|
||||||
assert len(expl) > 1
|
assert len(expl) > 1
|
||||||
expl = callequal([0, 1, 2], [0, 1])
|
expl = callequal([0, 1, 2], [0, 1])
|
||||||
|
|
|
@ -271,7 +271,7 @@ class TestAssertionRewrite:
|
||||||
|
|
||||||
getmsg(f, must_pass=True)
|
getmsg(f, must_pass=True)
|
||||||
|
|
||||||
def test_short_circut_evaluation(self):
|
def test_short_circuit_evaluation(self):
|
||||||
def f():
|
def f():
|
||||||
assert True or explode # noqa
|
assert True or explode # noqa
|
||||||
|
|
||||||
|
|
|
@ -604,7 +604,7 @@ def test_capture_binary_output(testdir):
|
||||||
|
|
||||||
|
|
||||||
def test_error_during_readouterr(testdir):
|
def test_error_during_readouterr(testdir):
|
||||||
"""Make sure we suspend capturing if errors occurr during readouterr"""
|
"""Make sure we suspend capturing if errors occur during readouterr"""
|
||||||
testdir.makepyfile(pytest_xyz="""
|
testdir.makepyfile(pytest_xyz="""
|
||||||
from _pytest.capture import FDCapture
|
from _pytest.capture import FDCapture
|
||||||
def bad_snap(self):
|
def bad_snap(self):
|
||||||
|
|
|
@ -197,7 +197,7 @@ class TestNewSession(SessionTests):
|
||||||
colfail = [x for x in finished if x.failed]
|
colfail = [x for x in finished if x.failed]
|
||||||
assert len(colfail) == 1
|
assert len(colfail) == 1
|
||||||
|
|
||||||
def test_minus_x_overriden_by_maxfail(self, testdir):
|
def test_minus_x_overridden_by_maxfail(self, testdir):
|
||||||
testdir.makepyfile(__init__="")
|
testdir.makepyfile(__init__="")
|
||||||
testdir.makepyfile(test_one="xxxx", test_two="yyyy", test_third="zzz")
|
testdir.makepyfile(test_one="xxxx", test_two="yyyy", test_third="zzz")
|
||||||
reprec = testdir.inline_run("-x", "--maxfail=2", testdir.tmpdir)
|
reprec = testdir.inline_run("-x", "--maxfail=2", testdir.tmpdir)
|
||||||
|
|
Loading…
Reference in New Issue