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=pypy
- TOXENV=pypy3 - TOXENV=pypy3
- TOXENV=pep8 - TOXENV=pep8
- TOXENV=py34-failskip
- TOXENV=py34-limit
- TOXENV=py34-prefix
notifications: notifications:
irc: "chat.freenode.net#gabbi" irc: "chat.freenode.net#gabbi"

View File

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

View File

@ -12,6 +12,11 @@ tests:
url: / url: /
verbose: True verbose: True
- name: get simple page xfail uxsuccess
xfail: true
url: /
verbose: True
- name: inheritance of defaults - name: inheritance of defaults
response_headers: response_headers:
x-gabbi-url: $SCHEME://$NETLOC/cow?alpha=1 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 # Run the tests and confirm that the stuff we expect to skip or fail
# does. # does.
GREP_FAIL_MATCH='expected failures=8' 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 && \ python setup.py testr && \
testr last --subunit | subunit2pyunit 2>&1 | \ for match in "${GREP_FAIL_MATCH}" "${GREP_UXSUC_MATCH}" "${GREP_SKIP_MATCH}"; do
grep "${GREP_FAIL_MATCH}" && \ testr last --subunit | subunit2pyunit 2>&1 | \
testr last | grep "${GREP_SKIP_MATCH}" grep "${match}"
done

View File

@ -1,7 +1,7 @@
[tox] [tox]
minversion = 1.6 minversion = 1.6
skipsdist = True 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] [testenv]
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
@ -29,6 +29,12 @@ commands = {toxinidir}/test-limit.sh
[testenv:failskip] [testenv:failskip]
commands = {toxinidir}/test-failskip.sh commands = {toxinidir}/test-failskip.sh
[testenv:py34-limit]
commands = {toxinidir}/test-limit.sh
[testenv:py34-failskip]
commands = {toxinidir}/test-failskip.sh
[testenv:cover] [testenv:cover]
commands = python setup.py testr --coverage --testr-args="{posargs}" commands = python setup.py testr --coverage --testr-args="{posargs}"