From 5902e5a2ce1b17d5e986db9bf0eed6013bf80352 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 13 Nov 2018 01:26:22 +0100 Subject: [PATCH 1/3] Travis: move faster builds to baseline - use py27-pexpect,py27-trial,py27-numpy and py37-xdist in baseline, using pexpect there catches errors with pdb tests early, and py37-xdist is much faster than py37. - move py34 and py36 out of baseline. --- .travis.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 72731b3d0..1c055e663 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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' From 3e05848ab9ade1edd7b55f307a4e86f3411d0a9c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 13 Nov 2018 01:33:05 +0100 Subject: [PATCH 2/3] AppVeyor: run py{27,37}-xdist first --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 47f5db9e6..9a50d5bd0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 From 27dab4e05f56a64b67e203400e52feb6d2663214 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 13 Nov 2018 08:48:07 +0100 Subject: [PATCH 3/3] Fix CallInfo.__repr__ for unfinished call Fixes https://github.com/pytest-dev/pytest/issues/3554 Ref: https://github.com/pytest-dev/pytest/pull/3560 Ref: https://github.com/pytest-dev/pytest/pull/3562 --- changelog/3554.bugfix.rst | 1 + src/_pytest/runner.py | 3 ++- testing/test_runner.py | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 changelog/3554.bugfix.rst diff --git a/changelog/3554.bugfix.rst b/changelog/3554.bugfix.rst new file mode 100644 index 000000000..b4c43cb8f --- /dev/null +++ b/changelog/3554.bugfix.rst @@ -0,0 +1 @@ +Fix ``CallInfo.__repr__`` for when the call is not finished yet. diff --git a/src/_pytest/runner.py b/src/_pytest/runner.py index 4d4b06d7c..c2de759b3 100644 --- a/src/_pytest/runner.py +++ b/src/_pytest/runner.py @@ -224,7 +224,8 @@ class CallInfo(object): if self.excinfo: status = "exception: %s" % str(self.excinfo.value) else: - status = "result: %r" % (self.result,) + result = getattr(self, "result", "") + status = "result: %r" % (result,) return "" % (self.when, status) diff --git a/testing/test_runner.py b/testing/test_runner.py index 2d55e9e5a..c081920a5 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -491,13 +491,26 @@ def test_callinfo(): assert ci.when == "123" assert ci.result == 0 assert "result" in repr(ci) + assert repr(ci) == "" + ci = runner.CallInfo(lambda: 0 / 0, "123") assert ci.when == "123" assert not hasattr(ci, "result") + assert repr(ci) == "" 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"]) == "'>" + + ci = runner.CallInfo(repr_while_running, "when") + assert repr(ci) == "" + + # design question: do we want general hooks in python files? # then something like the following functional tests makes sense