Ensure the unexpected success works in python3

And ensure there is coverage for unexpected success in both python3
and 2 and in travis.
This commit is contained in:
Chris Dent 2015-07-31 14:13:14 +01:00
parent b23b5e9cb3
commit 981363376e
5 changed files with 26 additions and 7 deletions

View File

@ -12,6 +12,9 @@ env:
- TOXENV=pypy
- TOXENV=pypy3
- TOXENV=pep8
- TOXENV=py34-failskip
- TOXENV=py34-limit
- TOXENV=py34-prefix
notifications:
irc: "chat.freenode.net#gabbi"

View File

@ -77,7 +77,10 @@ def potentialFailure(func):
else:
self._addExpectedFailure(self.result, sys.exc_info())
else:
raise case._UnexpectedSuccess
if hasattr(self, '_addUnexpectedSuccess'):
self._addUnexpectedSuccess(self.result)
else:
raise case._UnexpectedSuccess
else:
func(self)
return wrapper

View File

@ -12,6 +12,11 @@ tests:
url: /
verbose: True
- name: get simple page xfail uxsuccess
xfail: true
url: /
verbose: True
- name: inheritance of defaults
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/cow?alpha=1

View File

@ -1,11 +1,13 @@
#!/bin/bash
#!/bin/bash -e
# Run the tests and confirm that the stuff we expect to skip or fail
# does.
GREP_FAIL_MATCH='expected failures=8'
GREP_SKIP_MATCH='skips=2'
GREP_SKIP_MATCH='skipped=2'
GREP_UXSUC_MATCH='unexpected successes=1'
python setup.py testr && \
testr last --subunit | subunit2pyunit 2>&1 | \
grep "${GREP_FAIL_MATCH}" && \
testr last | grep "${GREP_SKIP_MATCH}"
for match in "${GREP_FAIL_MATCH}" "${GREP_UXSUC_MATCH}" "${GREP_SKIP_MATCH}"; do
testr last --subunit | subunit2pyunit 2>&1 | \
grep "${match}"
done

View File

@ -1,7 +1,7 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = py27,py33,py34,py35,pypy,pypy3,pep8,limit,failskip,docs,py34-prefix
envlist = py27,py33,py34,py35,pypy,pypy3,pep8,limit,failskip,docs,py34-prefix,py34-limit,py34-failskip
[testenv]
deps = -r{toxinidir}/requirements.txt
@ -29,6 +29,12 @@ commands = {toxinidir}/test-limit.sh
[testenv:failskip]
commands = {toxinidir}/test-failskip.sh
[testenv:py34-limit]
commands = {toxinidir}/test-limit.sh
[testenv:py34-failskip]
commands = {toxinidir}/test-failskip.sh
[testenv:cover]
commands = python setup.py testr --coverage --testr-args="{posargs}"