-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
type: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously
Milestone
Description
The werkzeug tests fail with pytest 6:
def test_import_string_provides_traceback(tmpdir, monkeypatch):
monkeypatch.syspath_prepend(str(tmpdir))
# Couple of packages
dir_a = tmpdir.mkdir("a")
dir_b = tmpdir.mkdir("b")
# Totally packages, I promise
dir_a.join("__init__.py").write("")
dir_b.join("__init__.py").write("")
# 'aa.a' that depends on 'bb.b', which in turn has a broken import
dir_a.join("aa.py").write("from b import bb")
dir_b.join("bb.py").write("from os import a_typo")
# Do we get all the useful information in the traceback?
with pytest.raises(ImportError) as baz_exc:
utils.import_string("a.aa")
traceback = "".join(str(line) for line in baz_exc.traceback)
> assert "bb.py':1" in traceback # a bit different than typical python tb
E assert "bb.py':1" in " File local('/home/florian/tmp/werkzeugtest/werkzeug/tests/test_utils.py'):205 in test_import_string_provides_traceb...l('/tmp/pytest-of-florian/pytest-29/test_import_string_provides_tr0/b/bb.py'):1 in <module>\n from os import a_typo\n"
This is because of 2ee9088 (#7274, "code: remove last usage of py.error") - it removed the str(...)
, but the format string uses %r
, so now we get the repr of the py.path.local
object instead of the repr of a string.
I believe this should continue to use "%r" % str(self.path)
so the output is the same in all cases.
hroncok and Zac-HD
Metadata
Metadata
Assignees
Labels
type: regressionindicates a problem that was introduced in a release which was working previouslyindicates a problem that was introduced in a release which was working previously