[Python-modules-commits] [pytest] 01/08: Import pytest_3.0.7.orig.tar.gz
Sebastian Ramacher
sramacher at moszumanska.debian.org
Tue Mar 21 20:52:28 UTC 2017
This is an automated email from the git hooks/post-receive script.
sramacher pushed a commit to branch master
in repository pytest.
commit 7ffbaa40a33a9ba777e46f42958249eda9cdbc6d
Author: Sebastian Ramacher <sramacher at debian.org>
Date: Tue Mar 21 21:03:45 2017 +0100
Import pytest_3.0.7.orig.tar.gz
---
.gitattributes | 1 -
.gitignore | 36 -
AUTHORS | 9 +-
CHANGELOG.rst | 65 +-
PKG-INFO | 3 +-
_pytest/__init__.py | 2 +-
_pytest/_code/code.py | 6 +-
_pytest/assertion/rewrite.py | 3 +-
_pytest/cacheprovider.py | 2 +-
_pytest/config.py | 19 +-
_pytest/fixtures.py | 7 +-
_pytest/hookspec.py | 13 +-
_pytest/junitxml.py | 9 +-
_pytest/main.py | 2 +-
_pytest/mark.py | 2 +-
_pytest/pytester.py | 8 +-
_pytest/python.py | 4 +-
_pytest/skipping.py | 5 +-
_pytest/terminal.py | 4 +-
_pytest/tmpdir.py | 2 +-
_pytest/unittest.py | 24 +-
doc/en/announce/index.rst | 1 +
doc/en/announce/release-3.0.7.rst | 33 +
doc/en/assert.rst | 12 +-
doc/en/cache.rst | 16 +-
doc/en/capture.rst | 4 +-
doc/en/doctest.rst | 2 +-
doc/en/example/markers.rst | 56 +-
doc/en/example/nonpython.rst | 12 +-
doc/en/example/parametrize.rst | 32 +-
doc/en/example/pythoncollection.rst | 6 +-
doc/en/example/reportingdemo.rst | 32 +-
doc/en/example/simple.rst | 44 +-
doc/en/fixture.rst | 53 +-
doc/en/getting-started.rst | 8 +-
doc/en/index.rst | 4 +-
doc/en/parametrize.rst | 12 +-
doc/en/parametrize.rst.orig | 238 ------
doc/en/skipping.rst | 4 +-
doc/en/talks.rst | 4 +-
doc/en/tmpdir.rst | 4 +-
doc/en/unittest.rst | 21 +-
doc/en/writing_plugins.rst | 25 +-
pytest.egg-info/PKG-INFO | 3 +-
pytest.egg-info/SOURCES.txt | 5 +-
setup.cfg | 1 +
setup.py | 2 +-
testing/python/collect.py | 10 +
testing/python/metafunc.py.orig | 1494 -----------------------------------
testing/test_assertion.py | 21 +-
testing/test_assertrewrite.py | 2 +-
testing/test_capture.py | 2 +-
testing/test_config.py | 17 +-
testing/test_junitxml.py | 19 +
testing/test_pdb.py | 15 +
testing/test_session.py | 2 +-
testing/test_skipping.py | 23 +
testing/test_terminal.py | 9 +
tox.ini | 3 +-
59 files changed, 480 insertions(+), 1997 deletions(-)
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 242d3da..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-CHANGELOG merge=union
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 0e42b11..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,36 +0,0 @@
-# Automatically generated by `hgimportsvn`
-.svn
-.hgsvn
-
-# Ignore local virtualenvs
-lib/
-bin/
-include/
-.Python/
-
-# These lines are suggested according to the svn:ignore property
-# Feel free to enable them by uncommenting them
-*.pyc
-*.pyo
-*.swp
-*.class
-*.orig
-*~
-.hypothesis/
-
-.eggs/
-
-doc/*/_build
-build/
-dist/
-*.egg-info
-issue/
-env/
-.env/
-3rdparty/
-.tox
-.cache
-.coverage
-.ropeproject
-.idea
-.hypothesis
diff --git a/AUTHORS b/AUTHORS
index acf715c..ce19f1f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -16,6 +16,7 @@ Antony Lee
Armin Rigo
Aron Curzon
Aviv Palivoda
+Barney Gale
Ben Webb
Benjamin Peterson
Bernard Pratz
@@ -42,12 +43,14 @@ Dave Hunt
David Díaz-Barquero
David Mohr
David Vierra
+Denis Kirisov
Diego Russo
Dmitry Dygalo
Duncan Betts
Edison Gustavo Muenz
Edoardo Batini
Eduardo Schettino
+Eli Boyarski
Elizaveta Shashkova
Endre Galaczi
Eric Hunsberger
@@ -111,11 +114,14 @@ Nicolas Delaby
Oleg Pidsadnyi
Oliver Bestwalter
Omar Kohl
+Omer Hadari
+Patrick Hayes
Pieter Mulder
Piotr Banaszkiewicz
Punyashloka Biswal
Quentin Pradet
Ralf Schmitt
+Ran Benita
Raphael Pierzina
Raquel Alegre
Roberto Polli
@@ -139,6 +145,7 @@ Tom Viner
Trevor Bekolay
Tyler Goodlet
Vasily Kuznetsov
+Victor Uriarte
+Vidar T. Fauske
Wouter van Ackooy
Xuecong Liao
-Eli Boyarski
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index bf29797..19b62a1 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,5 +1,63 @@
-3.0.6 (2017-01-29)
-=======================
+3.0.7 (2017-03-14)
+==================
+
+
+* Fix issue in assertion rewriting breaking due to modules silently discarding
+ other modules when importing fails
+ Notably, importing the `anydbm` module is fixed. (`#2248`_).
+ Thanks `@pfhayes`_ for the PR.
+
+* junitxml: Fix problematic case where system-out tag occured twice per testcase
+ element in the XML report. Thanks `@kkoukiou`_ for the PR.
+
+* Fix regression, pytest now skips unittest correctly if run with ``--pdb``
+ (`#2137`_). Thanks to `@gst`_ for the report and `@mbyt`_ for the PR.
+
+* Ignore exceptions raised from descriptors (e.g. properties) during Python test collection (`#2234`_).
+ Thanks to `@bluetech`_.
+
+* ``--override-ini`` now correctly overrides some fundamental options like ``python_files`` (`#2238`_).
+ Thanks `@sirex`_ for the report and `@nicoddemus`_ for the PR.
+
+* Replace ``raise StopIteration`` usages in the code by simple ``returns`` to finish generators, in accordance to `PEP-479`_ (`#2160`_).
+ Thanks `@tgoodlet`_ for the report and `@nicoddemus`_ for the PR.
+
+* Fix internal errors when an unprintable ``AssertionError`` is raised inside a test.
+ Thanks `@omerhadari`_ for the PR.
+
+* Skipping plugin now also works with test items generated by custom collectors (`#2231`_).
+ Thanks to `@vidartf`_.
+
+* Fix trailing whitespace in console output if no .ini file presented (`#2281`_). Thanks `@fbjorn`_ for the PR.
+
+* Conditionless ``xfail`` markers no longer rely on the underlying test item
+ being an instance of ``PyobjMixin``, and can therefore apply to tests not
+ collected by the built-in python test collector. Thanks `@barneygale`_ for the
+ PR.
+
+
+.. _ at pfhayes: https://github.com/pfhayes
+.. _ at bluetech: https://github.com/bluetech
+.. _ at gst: https://github.com/gst
+.. _ at sirex: https://github.com/sirex
+.. _ at vidartf: https://github.com/vidartf
+.. _ at kkoukiou: https://github.com/KKoukiou
+.. _ at omerhadari: https://github.com/omerhadari
+.. _ at fbjorn: https://github.com/fbjorn
+
+.. _#2248: https://github.com/pytest-dev/pytest/issues/2248
+.. _#2137: https://github.com/pytest-dev/pytest/issues/2137
+.. _#2160: https://github.com/pytest-dev/pytest/issues/2160
+.. _#2231: https://github.com/pytest-dev/pytest/issues/2231
+.. _#2234: https://github.com/pytest-dev/pytest/issues/2234
+.. _#2238: https://github.com/pytest-dev/pytest/issues/2238
+.. _#2281: https://github.com/pytest-dev/pytest/issues/2281
+
+.. _PEP-479: https://www.python.org/dev/peps/pep-0479/
+
+
+3.0.6 (2017-01-22)
+==================
* pytest no longer generates ``PendingDeprecationWarning`` from its own operations, which was introduced by mistake in version ``3.0.5`` (`#2118`_).
Thanks to `@nicoddemus`_ for the report and `@RonnyPfannschmidt`_ for the PR.
@@ -30,6 +88,7 @@
terminal output it relies on is missing. Thanks to `@eli-b`_ for the PR.
+.. _ at barneygale: https://github.com/barneygale
.. _ at lesteve: https://github.com/lesteve
.. _ at malinoff: https://github.com/malinoff
.. _ at pelme: https://github.com/pelme
@@ -2360,7 +2419,7 @@ Bug fixes:
teardown function are called earlier.
- add an all-powerful metafunc.parametrize function which allows to
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
call a test function with different argument values
- Add examples to the "parametrize" example page, including a quick port
diff --git a/PKG-INFO b/PKG-INFO
index b394ec3..5ca32a9 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pytest
-Version: 3.0.6
+Version: 3.0.7
Summary: pytest: simple powerful testing with Python
Home-page: http://pytest.org
Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others
@@ -131,3 +131,4 @@ Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
diff --git a/_pytest/__init__.py b/_pytest/__init__.py
index a4739a6..45375bc 100644
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,2 +1,2 @@
#
-__version__ = '3.0.6'
+__version__ = '3.0.7'
diff --git a/_pytest/_code/code.py b/_pytest/_code/code.py
index 616d5c4..6eceb0c 100644
--- a/_pytest/_code/code.py
+++ b/_pytest/_code/code.py
@@ -352,6 +352,8 @@ class ExceptionInfo(object):
help for navigating the traceback.
"""
_striptext = ''
+ _assert_start_repr = "AssertionError(u\'assert " if sys.version_info[0] < 3 else "AssertionError(\'assert "
+
def __init__(self, tup=None, exprinfo=None):
import _pytest._code
if tup is None:
@@ -359,8 +361,8 @@ class ExceptionInfo(object):
if exprinfo is None and isinstance(tup[1], AssertionError):
exprinfo = getattr(tup[1], 'msg', None)
if exprinfo is None:
- exprinfo = py._builtin._totext(tup[1])
- if exprinfo and exprinfo.startswith('assert '):
+ exprinfo = py.io.saferepr(tup[1])
+ if exprinfo and exprinfo.startswith(self._assert_start_repr):
self._striptext = 'AssertionError: '
self._excinfo = tup
#: the exception class
diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py
index abf5b49..7408c47 100644
--- a/_pytest/assertion/rewrite.py
+++ b/_pytest/assertion/rewrite.py
@@ -215,7 +215,8 @@ class AssertionRewritingHook(object):
mod.__loader__ = self
py.builtin.exec_(co, mod.__dict__)
except:
- del sys.modules[name]
+ if name in sys.modules:
+ del sys.modules[name]
raise
return sys.modules[name]
diff --git a/_pytest/cacheprovider.py b/_pytest/cacheprovider.py
index 0657001..893f0ea 100755
--- a/_pytest/cacheprovider.py
+++ b/_pytest/cacheprovider.py
@@ -1,7 +1,7 @@
"""
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
"""
diff --git a/_pytest/config.py b/_pytest/config.py
index 42d1a11..c73416f 100644
--- a/_pytest/config.py
+++ b/_pytest/config.py
@@ -877,6 +877,7 @@ class Config(object):
self.trace = self.pluginmanager.trace.root.get("config")
self.hook = self.pluginmanager.hook
self._inicache = {}
+ self._override_ini = ()
self._opt2dest = {}
self._cleanup = []
self._warn = self.pluginmanager._warn
@@ -977,6 +978,7 @@ class Config(object):
self.invocation_dir = py.path.local()
self._parser.addini('addopts', 'extra command line options', 'args')
self._parser.addini('minversion', 'minimally required pytest version')
+ self._override_ini = ns.override_ini or ()
def _consider_importhook(self, args, entrypoint_name):
"""Install the PEP 302 import hook if using assertion re-writing.
@@ -1159,15 +1161,14 @@ class Config(object):
# and -o foo1=bar1 -o foo2=bar2 options
# always use the last item if multiple value set for same ini-name,
# e.g. -o foo=bar1 -o foo=bar2 will set foo to bar2
- if self.getoption("override_ini", None):
- for ini_config_list in self.option.override_ini:
- for ini_config in ini_config_list:
- try:
- (key, user_ini_value) = ini_config.split("=", 1)
- except ValueError:
- raise UsageError("-o/--override-ini expects option=value style.")
- if key == name:
- value = user_ini_value
+ for ini_config_list in self._override_ini:
+ for ini_config in ini_config_list:
+ try:
+ (key, user_ini_value) = ini_config.split("=", 1)
+ except ValueError:
+ raise UsageError("-o/--override-ini expects option=value style.")
+ if key == name:
+ value = user_ini_value
return value
def getoption(self, name, default=notset, skip=False):
diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py
index 28bcd4d..248708f 100644
--- a/_pytest/fixtures.py
+++ b/_pytest/fixtures.py
@@ -14,6 +14,7 @@ from _pytest.compat import (
getfslineno, get_real_func,
is_generator, isclass, getimfunc,
getlocation, getfuncargnames,
+ safe_getattr,
)
def pytest_sessionstart(session):
@@ -124,8 +125,6 @@ def getfixturemarker(obj):
exceptions."""
try:
return getattr(obj, "_pytestfixturefunction", None)
- except KeyboardInterrupt:
- raise
except Exception:
# some objects raise errors like request (from flask import request)
# we don't expect them to be fixture functions
@@ -1068,7 +1067,9 @@ class FixtureManager:
self._holderobjseen.add(holderobj)
autousenames = []
for name in dir(holderobj):
- obj = getattr(holderobj, name, None)
+ # The attribute can be an arbitrary descriptor, so the attribute
+ # access below can raise. safe_getatt() ignores such exceptions.
+ obj = safe_getattr(holderobj, name, None)
# fixture functions have a pytest_funcarg__ prefix (pre-2.3 style)
# or are "@pytest.fixture" marked
marker = getfixturemarker(obj)
diff --git a/_pytest/hookspec.py b/_pytest/hookspec.py
index b5f51ec..552a065 100644
--- a/_pytest/hookspec.py
+++ b/_pytest/hookspec.py
@@ -246,7 +246,7 @@ def pytest_unconfigure(config):
# -------------------------------------------------------------------------
-# hooks for customising the assert methods
+# hooks for customizing the assert methods
# -------------------------------------------------------------------------
def pytest_assertrepr_compare(config, op, left, right):
@@ -255,7 +255,7 @@ def pytest_assertrepr_compare(config, op, left, right):
Return None for no custom explanation, otherwise return a list
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
- 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.
"""
# -------------------------------------------------------------------------
@@ -263,7 +263,14 @@ def pytest_assertrepr_compare(config, op, left, right):
# -------------------------------------------------------------------------
def pytest_report_header(config, startdir):
- """ return a string to be displayed as header info for terminal reporting."""
+ """ return a string to be displayed as header info for terminal reporting.
+
+ .. note::
+
+ This function should be implemented only in plugins or ``conftest.py``
+ files situated at the tests root directory due to how pytest
+ :ref:`discovers plugins during startup <pluginorder>`.
+ """
@hookspec(firstresult=True)
def pytest_report_teststatus(report):
diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py
index 317382e..3f371c9 100644
--- a/_pytest/junitxml.py
+++ b/_pytest/junitxml.py
@@ -119,7 +119,7 @@ class _NodeReporter(object):
node = kind(data, message=message)
self.append(node)
- def _write_captured_output(self, report):
+ def write_captured_output(self, report):
for capname in ('out', 'err'):
content = getattr(report, 'capstd' + capname)
if content:
@@ -128,7 +128,6 @@ class _NodeReporter(object):
def append_pass(self, report):
self.add_stats('passed')
- self._write_captured_output(report)
def append_failure(self, report):
# msg = str(report.longrepr.reprtraceback.extraline)
@@ -147,7 +146,6 @@ class _NodeReporter(object):
fail = Junit.failure(message=message)
fail.append(bin_xml_escape(report.longrepr))
self.append(fail)
- self._write_captured_output(report)
def append_collect_error(self, report):
# msg = str(report.longrepr.reprtraceback.extraline)
@@ -165,7 +163,6 @@ class _NodeReporter(object):
msg = "test setup failure"
self._add_simple(
Junit.error, msg, report.longrepr)
- self._write_captured_output(report)
def append_skipped(self, report):
if hasattr(report, "wasxfail"):
@@ -180,7 +177,7 @@ class _NodeReporter(object):
Junit.skipped("%s:%s: %s" % (filename, lineno, skipreason),
type="pytest.skip",
message=skipreason))
- self._write_captured_output(report)
+ self.write_captured_output(report)
def finalize(self):
data = self.to_xml().unicode(indent=0)
@@ -345,6 +342,8 @@ class LogXML(object):
reporter.append_skipped(report)
self.update_testcase_duration(report)
if report.when == "teardown":
+ reporter = self._opentestcase(report)
+ reporter.write_captured_output(report)
self.finalize(report)
def update_testcase_duration(self, report):
diff --git a/_pytest/main.py b/_pytest/main.py
index a323527..b66b661 100644
--- a/_pytest/main.py
+++ b/_pytest/main.py
@@ -81,7 +81,7 @@ def pytest_namespace():
def pytest_configure(config):
- pytest.config = config # compatibiltiy
+ pytest.config = config # compatibility
def wrap_session(config, doit):
diff --git a/_pytest/mark.py b/_pytest/mark.py
index 357a604..d406bca 100644
--- a/_pytest/mark.py
+++ b/_pytest/mark.py
@@ -66,7 +66,7 @@ def pytest_collection_modifyitems(items, config):
return
# pytest used to allow "-" for negating
# but today we just allow "-" at the beginning, use "not" instead
- # we probably remove "-" alltogether soon
+ # we probably remove "-" altogether soon
if keywordexpr.startswith("-"):
keywordexpr = "not " + keywordexpr[1:]
selectuntil = False
diff --git a/_pytest/pytester.py b/_pytest/pytester.py
index 6c63bbb..de24f90 100644
--- a/_pytest/pytester.py
+++ b/_pytest/pytester.py
@@ -332,7 +332,7 @@ def testdir(request, tmpdir_factory):
return Testdir(request, tmpdir_factory)
-rex_outcome = re.compile("(\d+) ([\w-]+)")
+rex_outcome = re.compile(r"(\d+) ([\w-]+)")
class RunResult:
"""The result of running a command.
@@ -566,7 +566,7 @@ class Testdir:
def mkpydir(self, name):
"""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.
"""
@@ -661,7 +661,7 @@ class Testdir:
def inline_genitems(self, *args):
"""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.
This runs the :py:func:`pytest.main` function to run all of
@@ -857,7 +857,7 @@ class Testdir:
:py:meth:`parseconfigure`.
: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()}
diff --git a/_pytest/python.py b/_pytest/python.py
index e46f2f1..3e865e9 100644
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -174,7 +174,7 @@ def pytest_pycollect_makeitem(collector, name, obj):
outcome = yield
res = outcome.get_result()
if res is not None:
- raise StopIteration
+ return
# nothing was collected elsewhere, let's do it here
if isclass(obj):
if collector.istestclass(obj, name):
@@ -629,7 +629,7 @@ class Generator(FunctionMixin, PyCollector):
def getcallargs(self, obj):
if not isinstance(obj, (tuple, list)):
obj = (obj,)
- # explict naming
+ # explicit naming
if isinstance(obj[0], py.builtin._basestring):
name = obj[0]
obj = obj[1:]
diff --git a/_pytest/skipping.py b/_pytest/skipping.py
index 91a3416..0af5573 100644
--- a/_pytest/skipping.py
+++ b/_pytest/skipping.py
@@ -112,14 +112,14 @@ class MarkEvaluator:
def _getglobals(self):
d = {'os': os, 'sys': sys, 'config': self.item.config}
- d.update(self.item.obj.__globals__)
+ if hasattr(self.item, 'obj'):
+ d.update(self.item.obj.__globals__)
return d
def _istrue(self):
if hasattr(self, 'result'):
return self.result
if self.holder:
- d = self._getglobals()
if self.holder.args or 'condition' in self.holder.kwargs:
self.result = False
# "holder" might be a MarkInfo or a MarkDecorator; only
@@ -135,6 +135,7 @@ class MarkEvaluator:
for expr in args:
self.expr = expr
if isinstance(expr, py.builtin._basestring):
+ d = self._getglobals()
result = cached_eval(self.item.config, expr, d)
else:
if "reason" not in kwargs:
diff --git a/_pytest/terminal.py b/_pytest/terminal.py
index 16bf757..79e0653 100644
--- a/_pytest/terminal.py
+++ b/_pytest/terminal.py
@@ -295,8 +295,8 @@ class TerminalReporter:
def pytest_report_header(self, config):
inifile = ""
if config.inifile:
- inifile = config.rootdir.bestrelpath(config.inifile)
- lines = ["rootdir: %s, inifile: %s" %(config.rootdir, inifile)]
+ inifile = " " + config.rootdir.bestrelpath(config.inifile)
+ lines = ["rootdir: %s, inifile:%s" % (config.rootdir, inifile)]
plugininfo = config.pluginmanager.list_plugin_distinfo()
if plugininfo:
diff --git a/_pytest/tmpdir.py b/_pytest/tmpdir.py
index 28a6b06..0f878ad 100644
--- a/_pytest/tmpdir.py
+++ b/_pytest/tmpdir.py
@@ -116,7 +116,7 @@ def tmpdir(request, tmpdir_factory):
path object.
"""
name = request.node.name
- name = re.sub("[\W]", "_", name)
+ name = re.sub(r"[\W]", "_", name)
MAXVAL = 30
if len(name) > MAXVAL:
name = name[:MAXVAL]
diff --git a/_pytest/unittest.py b/_pytest/unittest.py
index 7322401..276b9ba 100644
--- a/_pytest/unittest.py
+++ b/_pytest/unittest.py
@@ -5,7 +5,7 @@ import sys
import traceback
import pytest
-# for transfering markers
+# for transferring markers
import _pytest._code
from _pytest.python import transfer_markers
from _pytest.skipping import MarkEvaluator
@@ -65,7 +65,6 @@ class UnitTestCase(pytest.Class):
yield TestCaseFunction('runTest', parent=self)
-
class TestCaseFunction(pytest.Function):
_excinfo = None
@@ -152,14 +151,33 @@ class TestCaseFunction(pytest.Function):
def stopTest(self, testcase):
pass
+ def _handle_skip(self):
+ # implements the skipping machinery (see #2137)
+ # analog to pythons Lib/unittest/case.py:run
+ testMethod = getattr(self._testcase, self._testcase._testMethodName)
+ if (getattr(self._testcase.__class__, "__unittest_skip__", False) or
+ getattr(testMethod, "__unittest_skip__", False)):
+ # If the class or method was skipped.
+ skip_why = (getattr(self._testcase.__class__, '__unittest_skip_why__', '') or
+ getattr(testMethod, '__unittest_skip_why__', ''))
+ try: # PY3, unittest2 on PY2
+ self._testcase._addSkip(self, self._testcase, skip_why)
+ except TypeError: # PY2
+ if sys.version_info[0] != 2:
+ raise
+ self._testcase._addSkip(self, skip_why)
+ return True
+ return False
+
def runtest(self):
if self.config.pluginmanager.get_plugin("pdbinvoke") is None:
self._testcase(result=self)
else:
# disables tearDown and cleanups for post mortem debugging (see #1890)
+ if self._handle_skip():
+ return
self._testcase.debug()
-
def _prunetraceback(self, excinfo):
pytest.Function._prunetraceback(self, excinfo)
traceback = excinfo.traceback.filter(
diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst
index 5cf8b4d..52dd90d 100644
--- a/doc/en/announce/index.rst
+++ b/doc/en/announce/index.rst
@@ -6,6 +6,7 @@ Release announcements
:maxdepth: 2
+ release-3.0.7
release-3.0.6
release-3.0.5
release-3.0.4
diff --git a/doc/en/announce/release-3.0.7.rst b/doc/en/announce/release-3.0.7.rst
new file mode 100644
index 0000000..591557a
--- /dev/null
+++ b/doc/en/announce/release-3.0.7.rst
@@ -0,0 +1,33 @@
+pytest-3.0.7
+============
+
+pytest 3.0.7 has just been released to PyPI.
+
+This is a bug-fix release, being a drop-in replacement. To upgrade::
+
+ pip install --upgrade pytest
+
+The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
+
+Thanks to all who contributed to this release, among them:
+
+* Anthony Sottile
+* Barney Gale
+* Bruno Oliveira
+* Florian Bruhin
+* Floris Bruynooghe
+* Ionel Cristian Mărieș
+* Katerina Koukiou
+* NODA, Kai
+* Omer Hadari
+* Patrick Hayes
+* Ran Benita
+* Ronny Pfannschmidt
+* Victor Uriarte
+* Vidar Tonaas Fauske
+* Ville Skyttä
+* fbjorn
+* mbyt
+
+Happy testing,
+The pytest Development Team
diff --git a/doc/en/assert.rst b/doc/en/assert.rst
index d93da17..b674f90 100644
--- a/doc/en/assert.rst
+++ b/doc/en/assert.rst
@@ -26,8 +26,8 @@ you will see the return value of the function call::
$ pytest test_assert1.py
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
- rootdir: $REGENDOC_TMPDIR, inifile:
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
+ rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
test_assert1.py F
@@ -170,8 +170,8 @@ if you run this module::
$ pytest test_assert2.py
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
- rootdir: $REGENDOC_TMPDIR, inifile:
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
+ rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
test_assert2.py F
@@ -183,7 +183,7 @@ if you run this module::
set1 = set("1308")
set2 = set("8035")
> assert set1 == set2
- E assert {'0', '1', '3', '8'} == {'0', '3', '5', '8'}
+ E AssertionError: assert {'0', '1', '3', '8'} == {'0', '3', '5', '8'}
E Extra items in the left set:
E '1'
E Extra items in the right set:
@@ -287,5 +287,5 @@ For further information, Benjamin Peterson wrote up `Behind the scenes of pytest
``--nomagic``.
.. versionchanged:: 3.0
- Removes the ``--no-assert`` and``--nomagic`` options.
+ Removes the ``--no-assert`` and ``--nomagic`` options.
Removes the ``--assert=reinterp`` option.
diff --git a/doc/en/cache.rst b/doc/en/cache.rst
index 3b4703b..b3b9925 100644
--- a/doc/en/cache.rst
+++ b/doc/en/cache.rst
@@ -80,9 +80,9 @@ If you then run it with ``--lf``::
$ pytest --lf
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
run-last-failure: rerun last 2 failures
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collected 50 items
test_50.py FF
@@ -122,9 +122,9 @@ of ``FF`` and dots)::
$ pytest --ff
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
run-last-failure: rerun last 2 failures first
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collected 50 items
test_50.py FF................................................
@@ -227,14 +227,14 @@ You can always peek at the content of the cache using the
$ py.test --cache-show
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
- rootdir: $REGENDOC_TMPDIR, inifile:
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
+ rootdir: $REGENDOC_TMPDIR, inifile:
cachedir: $REGENDOC_TMPDIR/.cache
------------------------------- cache values -------------------------------
- example/value contains:
- 42
cache/lastfailed contains:
{'test_caching.py::test_function': True}
+ example/value contains:
+ 42
======= no tests ran in 0.12 seconds ========
diff --git a/doc/en/capture.rst b/doc/en/capture.rst
index 2010066..2f666b7 100644
--- a/doc/en/capture.rst
+++ b/doc/en/capture.rst
@@ -64,8 +64,8 @@ of the failing function and hide the other one::
$ pytest
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
- rootdir: $REGENDOC_TMPDIR, inifile:
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
+ rootdir: $REGENDOC_TMPDIR, inifile:
collected 2 items
test_module.py .F
diff --git a/doc/en/doctest.rst b/doc/en/doctest.rst
index 4cbf92b..fd92eb7 100644
--- a/doc/en/doctest.rst
+++ b/doc/en/doctest.rst
@@ -49,7 +49,7 @@ then you can just invoke ``pytest`` without command line options::
$ pytest
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
collected 1 items
diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst
index 7dd5c83..0c96d40 100644
--- a/doc/en/example/markers.rst
+++ b/doc/en/example/markers.rst
@@ -31,9 +31,9 @@ You can then restrict a test run to only run tests marked with ``webtest``::
$ pytest -v -m webtest
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5m
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
test_server.py::test_send_http PASSED
@@ -45,9 +45,9 @@ Or the inverse, running all tests except the webtest ones::
$ pytest -v -m "not webtest"
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5m
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
test_server.py::test_something_quick PASSED
@@ -66,9 +66,9 @@ tests based on their module, class, method, or function name::
$ pytest -v test_server.py::TestClass::test_method
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5m
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 5 items
test_server.py::TestClass::test_method PASSED
@@ -79,9 +79,9 @@ You can also select on the class::
$ pytest -v test_server.py::TestClass
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5m
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
test_server.py::TestClass::test_method PASSED
@@ -92,9 +92,9 @@ Or select multiple nodes::
$ pytest -v test_server.py::TestClass test_server.py::test_send_http
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5m
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 8 items
test_server.py::TestClass::test_method PASSED
@@ -130,9 +130,9 @@ select tests based on their names::
$ pytest -v -k http # running with the above defined example module
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5m
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
test_server.py::test_send_http PASSED
@@ -144,9 +144,9 @@ And you can also run all tests except the ones that match the keyword::
$ pytest -k "not send_http" -v
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5m
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
test_server.py::test_something_quick PASSED
@@ -160,9 +160,9 @@ Or to select "http" and "quick" tests::
$ pytest -k "http or quick" -v
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5m
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
- rootdir: $REGENDOC_TMPDIR, inifile:
+ rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
test_server.py::test_send_http PASSED
@@ -352,8 +352,8 @@ the test needs::
$ pytest -E stage2
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
- rootdir: $REGENDOC_TMPDIR, inifile:
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
+ rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
test_someenv.py s
@@ -364,8 +364,8 @@ and here is one that specifies exactly the environment needed::
$ pytest -E stage1
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
- rootdir: $REGENDOC_TMPDIR, inifile:
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
+ rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
test_someenv.py .
@@ -485,8 +485,8 @@ then you will see two tests skipped and two executed tests as expected::
$ pytest -rs # this option reports skip reasons
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.6, py-1.4.33, pluggy-0.4.0
- rootdir: $REGENDOC_TMPDIR, inifile:
+ platform linux -- Python 3.5.2, pytest-3.0.7, py-1.4.32, pluggy-0.4.0
+ rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items
... 2896 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pytest.git
More information about the Python-modules-commits
mailing list