pytest-dev#8204 migrate some tests to tmp_path fixture (#8209)

migrating some tests from tmpdir to tmp_path fixture
This commit is contained in:
sousajf1
2021-01-01 15:25:11 +00:00
committed by GitHub
parent 5f11a35b99
commit 20c59e3aa4
2 changed files with 14 additions and 9 deletions

View File

@@ -364,12 +364,12 @@ def test_excinfo_no_sourcecode():
assert s == " File '<string>':1 in <module>\n ???\n"
def test_excinfo_no_python_sourcecode(tmpdir):
def test_excinfo_no_python_sourcecode(tmp_path: Path) -> None:
# XXX: simplified locally testable version
tmpdir.join("test.txt").write("{{ h()}}:")
tmp_path.joinpath("test.txt").write_text("{{ h()}}:")
jinja2 = pytest.importorskip("jinja2")
loader = jinja2.FileSystemLoader(str(tmpdir))
loader = jinja2.FileSystemLoader(str(tmp_path))
env = jinja2.Environment(loader=loader)
template = env.get_template("test.txt")
excinfo = pytest.raises(ValueError, template.render, h=h)