diff options
author | 2012-04-09 11:38:35 +0200 | |
---|---|---|
committer | 2012-04-09 11:38:35 +0200 | |
commit | 48e9ff716b956e20641b87f93de299b7343c10ce (patch) | |
tree | e6717a3902501a217d77ac8fe00e452183e1f528 /_pytest | |
parent | testrunner: also generate junitxml for each test driver instance (diff) | |
download | pypy-48e9ff716b956e20641b87f93de299b7343c10ce.tar.gz pypy-48e9ff716b956e20641b87f93de299b7343c10ce.tar.bz2 pypy-48e9ff716b956e20641b87f93de299b7343c10ce.zip |
upgrade py and _pytest to current tip
Diffstat (limited to '_pytest')
-rw-r--r-- | _pytest/__init__.py | 2 | ||||
-rw-r--r-- | _pytest/assertion/rewrite.py | 1 | ||||
-rw-r--r-- | _pytest/junitxml.py | 22 | ||||
-rw-r--r-- | _pytest/skipping.py | 8 | ||||
-rw-r--r-- | _pytest/unittest.py | 12 |
5 files changed, 32 insertions, 13 deletions
diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 6c2941d5d5..93eddeac5c 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.2.3' +__version__ = '2.2.4.dev2' diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py index cf295ef1be..97eeb66238 100644 --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -1,7 +1,6 @@ """Rewrite assertion AST to produce nice error messages""" import ast -import collections import errno import itertools import imp diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py index 1c4bbd82e7..2859d2f681 100644 --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -34,15 +34,21 @@ class Junit(py.xml.Namespace): # this dynamically instead of hardcoding it. The spec range of valid # chars is: Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] # | [#x10000-#x10FFFF] -_illegal_unichrs = [(0x00, 0x08), (0x0B, 0x0C), (0x0E, 0x19), - (0xD800, 0xDFFF), (0xFDD0, 0xFFFF)] -_illegal_ranges = [unicode("%s-%s") % (unichr(low), unichr(high)) - for (low, high) in _illegal_unichrs +_legal_chars = (0x09, 0x0A, 0x0d) +_legal_ranges = ( + (0x20, 0xD7FF), + (0xE000, 0xFFFD), + (0x10000, 0x10FFFF), +) +_legal_xml_re = [unicode("%s-%s") % (unichr(low), unichr(high)) + for (low, high) in _legal_ranges if low < sys.maxunicode] -illegal_xml_re = re.compile(unicode('[%s]') % - unicode('').join(_illegal_ranges)) -del _illegal_unichrs -del _illegal_ranges +_legal_xml_re = [unichr(x) for x in _legal_chars] + _legal_xml_re +illegal_xml_re = re.compile(unicode('[^%s]') % + unicode('').join(_legal_xml_re)) +del _legal_chars +del _legal_ranges +del _legal_xml_re def bin_xml_escape(arg): def repl(matchobj): diff --git a/_pytest/skipping.py b/_pytest/skipping.py index 6098c81a4b..46b15617d8 100644 --- a/_pytest/skipping.py +++ b/_pytest/skipping.py @@ -132,6 +132,14 @@ def check_xfail_no_run(item): def pytest_runtest_makereport(__multicall__, item, call): if not isinstance(item, pytest.Function): return + # unitttest special case, see setting of _unexpectedsuccess + if hasattr(item, '_unexpectedsuccess'): + rep = __multicall__.execute() + if rep.when == "call": + # we need to translate into how py.test encodes xpass + rep.keywords['xfail'] = "reason: " + item._unexpectedsuccess + rep.outcome = "failed" + return rep if not (call.excinfo and call.excinfo.errisinstance(py.test.xfail.Exception)): evalxfail = getattr(item, '_evalxfail', None) diff --git a/_pytest/unittest.py b/_pytest/unittest.py index 024c2998d8..903dc87a30 100644 --- a/_pytest/unittest.py +++ b/_pytest/unittest.py @@ -91,22 +91,28 @@ class TestCaseFunction(pytest.Function): self._addexcinfo(rawexcinfo) def addFailure(self, testcase, rawexcinfo): self._addexcinfo(rawexcinfo) + def addSkip(self, testcase, reason): try: pytest.skip(reason) except pytest.skip.Exception: self._addexcinfo(sys.exc_info()) - def addExpectedFailure(self, testcase, rawexcinfo, reason): + + def addExpectedFailure(self, testcase, rawexcinfo, reason=""): try: pytest.xfail(str(reason)) except pytest.xfail.Exception: self._addexcinfo(sys.exc_info()) - def addUnexpectedSuccess(self, testcase, reason): - pass + + def addUnexpectedSuccess(self, testcase, reason=""): + self._unexpectedsuccess = reason + def addSuccess(self, testcase): pass + def stopTest(self, testcase): pass + def runtest(self): self._testcase(result=self) |