From fee7c7b032b5995339375e8cfbaf8f9832aeb512 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 6 Nov 2019 14:10:20 +0100 Subject: [PATCH] py38: do not call None() directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Works around: _____ ERROR collecting testing/io/test_saferepr.py _____ src/_pytest/python.py:502: in _importtestmodule mod = self.fspath.pyimport(ensuresyspath=importmode) .venv38/lib/python3.8/site-packages/py/_path/local.py:701: in pyimport __import__(modname) :991: in _find_and_load ??? :975: in _find_and_load_unlocked ??? :671: in _load_unlocked ??? src/_pytest/assertion/rewrite.py:136: in exec_module source_stat, co = _rewrite_test(fn, self.config) src/_pytest/assertion/rewrite.py:288: in _rewrite_test co = compile(tree, fn, "exec", dont_inherit=True) E File "…/Vcs/pytest/testing/io/test_saferepr.py", line 45 E None() E ^ E SyntaxError: 'NoneType' object is not callable; perhaps you missed a comma? --- testing/io/test_saferepr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testing/io/test_saferepr.py b/testing/io/test_saferepr.py index db86ea4d5..e24d9b470 100644 --- a/testing/io/test_saferepr.py +++ b/testing/io/test_saferepr.py @@ -41,9 +41,10 @@ def test_exceptions(): assert "TypeError" in s assert "TypeError" in saferepr(BrokenRepr("string")) + none = None try: - None() - except Exception as exc: + none() + except BaseException as exc: exp_exc = repr(exc) obj = BrokenRepr(BrokenReprException("omg even worse")) s2 = saferepr(obj)