From 7631c231838d8ff766cc2065ccd8651a9a0ddba0 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 10 Feb 2018 15:10:19 -0500 Subject: Don't store the result_code. Just use it immediately. --- CHANGES.rst | 4 ++-- ptr.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 28f1b8a..48dce72 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,8 +2,8 @@ ===== * #38: Fixed AttributeError when running with ``--dry-run``. - ``PyTest.run()`` no longer returns the result code. Based on - the commit message for `840ff4c < + ``PyTest.run()`` no longer stores nor returns the result code. + Based on the commit message for `840ff4c < https://github.com/pytest-dev/pytest-runner/commit/840ff4c2bf6c752d9770f0dd8d64a841060cf9bc>`_, nothing has ever relied on that value. diff --git a/ptr.py b/ptr.py index 3de0129..a944278 100644 --- a/ptr.py +++ b/ptr.py @@ -192,8 +192,6 @@ class PyTest(orig.test): don't install them anywhere). """ self._super_run() - if getattr(self, 'result_code', None): - raise SystemExit(self.result_code) @property def _argv(self): @@ -204,4 +202,6 @@ class PyTest(orig.test): Invoke pytest, replacing argv. """ with _save_argv(_sys.argv[:1] + self.addopts): - self.result_code = __import__('pytest').main() + result_code = __import__('pytest').main() + if result_code: + raise SystemExit(result_code) -- cgit v1.2.1