Skip to content

Commit e025974

Browse files
committed
Merge remote-tracking branch 'upstream/master' into release-4.0.0
2 parents fea09cd + b7863a5 commit e025974

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ install:
1313
- pip install --upgrade --pre tox
1414
env:
1515
matrix:
16+
- TOXENV=py27
1617
# Specialized factors for py27.
17-
- TOXENV=py27-pexpect,py27-trial,py27-numpy
1818
- TOXENV=py27-nobyte
1919
- TOXENV=py27-xdist
2020
- TOXENV=py27-pluggymaster PYTEST_NO_COVERAGE=1
2121
# Specialized factors for py37.
2222
- TOXENV=py37-pexpect,py37-trial,py37-numpy
23-
- TOXENV=py37-xdist
2423
- TOXENV=py37-pluggymaster PYTEST_NO_COVERAGE=1
2524
- TOXENV=py37-freeze PYTEST_NO_COVERAGE=1
2625

@@ -30,8 +29,12 @@ jobs:
3029
- env: TOXENV=pypy PYTEST_NO_COVERAGE=1
3130
python: 'pypy-5.4'
3231
dist: trusty
32+
- env: TOXENV=py34
33+
python: '3.4'
3334
- env: TOXENV=py35
3435
python: '3.5'
36+
- env: TOXENV=py36
37+
python: '3.6'
3538
- env: TOXENV=py37
3639
- &test-macos
3740
language: generic
@@ -50,11 +53,8 @@ jobs:
5053
- brew link python
5154

5255
- stage: baseline
53-
env: TOXENV=py27
54-
- env: TOXENV=py34
55-
python: '3.4'
56-
- env: TOXENV=py36
57-
python: '3.6'
56+
env: TOXENV=py27-pexpect,py27-trial,py27-numpy
57+
- env: TOXENV=py37-xdist
5858
- env: TOXENV=linting,docs,doctesting
5959
python: '3.7'
6060

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
environment:
22
matrix:
3+
- TOXENV: "py37-xdist"
4+
- TOXENV: "py27-xdist"
35
- TOXENV: "py27"
46
- TOXENV: "py37"
57
- TOXENV: "linting,docs,doctesting"
@@ -12,14 +14,12 @@ environment:
1214
- TOXENV: "py27-trial,py27-numpy,py27-nobyte"
1315
- TOXENV: "py27-pluggymaster"
1416
PYTEST_NO_COVERAGE: "1"
15-
- TOXENV: "py27-xdist"
1617
# Specialized factors for py37.
1718
- TOXENV: "py37-trial,py37-numpy"
1819
- TOXENV: "py37-pluggymaster"
1920
PYTEST_NO_COVERAGE: "1"
2021
- TOXENV: "py37-freeze"
2122
PYTEST_NO_COVERAGE: "1"
22-
- TOXENV: "py37-xdist"
2323

2424
matrix:
2525
fast_finish: true

changelog/3554.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ``CallInfo.__repr__`` for when the call is not finished yet.

src/_pytest/runner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ def __repr__(self):
223223
if self.excinfo:
224224
status = "exception: %s" % str(self.excinfo.value)
225225
else:
226-
status = "result: %r" % (self.result,)
226+
result = getattr(self, "result", "<NOTSET>")
227+
status = "result: %r" % (result,)
227228
return "<CallInfo when=%r %s>" % (self.when, status)
228229

229230

testing/test_runner.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,26 @@ def test_callinfo():
491491
assert ci.when == "123"
492492
assert ci.result == 0
493493
assert "result" in repr(ci)
494+
assert repr(ci) == "<CallInfo when='123' result: 0>"
495+
494496
ci = runner.CallInfo(lambda: 0 / 0, "123")
495497
assert ci.when == "123"
496498
assert not hasattr(ci, "result")
499+
assert repr(ci) == "<CallInfo when='123' exception: division by zero>"
497500
assert ci.excinfo
498501
assert "exc" in repr(ci)
499502

500503

504+
def test_callinfo_repr_while_running():
505+
def repr_while_running():
506+
f = sys._getframe().f_back
507+
assert "func" in f.f_locals
508+
assert repr(f.f_locals["self"]) == "<CallInfo when='when' result: '<NOTSET>'>"
509+
510+
ci = runner.CallInfo(repr_while_running, "when")
511+
assert repr(ci) == "<CallInfo when='when' result: None>"
512+
513+
501514
# design question: do we want general hooks in python files?
502515
# then something like the following functional tests makes sense
503516

0 commit comments

Comments
 (0)