Merge remote-tracking branch 'upstream/master' into release-4.0.0

This commit is contained in:
Bruno Oliveira 2018-11-13 20:58:24 +00:00
commit e025974cbd
5 changed files with 25 additions and 10 deletions

View File

@ -13,14 +13,13 @@ install:
- pip install --upgrade --pre tox
env:
matrix:
- TOXENV=py27
# Specialized factors for py27.
- TOXENV=py27-pexpect,py27-trial,py27-numpy
- TOXENV=py27-nobyte
- TOXENV=py27-xdist
- TOXENV=py27-pluggymaster PYTEST_NO_COVERAGE=1
# Specialized factors for py37.
- TOXENV=py37-pexpect,py37-trial,py37-numpy
- TOXENV=py37-xdist
- TOXENV=py37-pluggymaster PYTEST_NO_COVERAGE=1
- TOXENV=py37-freeze PYTEST_NO_COVERAGE=1
@ -30,8 +29,12 @@ jobs:
- env: TOXENV=pypy PYTEST_NO_COVERAGE=1
python: 'pypy-5.4'
dist: trusty
- env: TOXENV=py34
python: '3.4'
- env: TOXENV=py35
python: '3.5'
- env: TOXENV=py36
python: '3.6'
- env: TOXENV=py37
- &test-macos
language: generic
@ -50,11 +53,8 @@ jobs:
- brew link python
- stage: baseline
env: TOXENV=py27
- env: TOXENV=py34
python: '3.4'
- env: TOXENV=py36
python: '3.6'
env: TOXENV=py27-pexpect,py27-trial,py27-numpy
- env: TOXENV=py37-xdist
- env: TOXENV=linting,docs,doctesting
python: '3.7'

View File

@ -1,5 +1,7 @@
environment:
matrix:
- TOXENV: "py37-xdist"
- TOXENV: "py27-xdist"
- TOXENV: "py27"
- TOXENV: "py37"
- TOXENV: "linting,docs,doctesting"
@ -12,14 +14,12 @@ environment:
- TOXENV: "py27-trial,py27-numpy,py27-nobyte"
- TOXENV: "py27-pluggymaster"
PYTEST_NO_COVERAGE: "1"
- TOXENV: "py27-xdist"
# Specialized factors for py37.
- TOXENV: "py37-trial,py37-numpy"
- TOXENV: "py37-pluggymaster"
PYTEST_NO_COVERAGE: "1"
- TOXENV: "py37-freeze"
PYTEST_NO_COVERAGE: "1"
- TOXENV: "py37-xdist"
matrix:
fast_finish: true

View File

@ -0,0 +1 @@
Fix ``CallInfo.__repr__`` for when the call is not finished yet.

View File

@ -223,7 +223,8 @@ class CallInfo(object):
if self.excinfo:
status = "exception: %s" % str(self.excinfo.value)
else:
status = "result: %r" % (self.result,)
result = getattr(self, "result", "<NOTSET>")
status = "result: %r" % (result,)
return "<CallInfo when=%r %s>" % (self.when, status)

View File

@ -491,13 +491,26 @@ def test_callinfo():
assert ci.when == "123"
assert ci.result == 0
assert "result" in repr(ci)
assert repr(ci) == "<CallInfo when='123' result: 0>"
ci = runner.CallInfo(lambda: 0 / 0, "123")
assert ci.when == "123"
assert not hasattr(ci, "result")
assert repr(ci) == "<CallInfo when='123' exception: division by zero>"
assert ci.excinfo
assert "exc" in repr(ci)
def test_callinfo_repr_while_running():
def repr_while_running():
f = sys._getframe().f_back
assert "func" in f.f_locals
assert repr(f.f_locals["self"]) == "<CallInfo when='when' result: '<NOTSET>'>"
ci = runner.CallInfo(repr_while_running, "when")
assert repr(ci) == "<CallInfo when='when' result: None>"
# design question: do we want general hooks in python files?
# then something like the following functional tests makes sense