Rename variables 'tmpdir'->'tmp_path'
Rename this variables reflecting the migrations made with3bcd316f0
anded658d682
This commit is contained in:
parent
0e5e4e03e6
commit
09d4c5e30a
|
@ -127,16 +127,16 @@ class TestCollector:
|
||||||
|
|
||||||
class TestCollectFS:
|
class TestCollectFS:
|
||||||
def test_ignored_certain_directories(self, pytester: Pytester) -> None:
|
def test_ignored_certain_directories(self, pytester: Pytester) -> None:
|
||||||
tmpdir = pytester.path
|
tmp_path = pytester.path
|
||||||
ensure_file(tmpdir / "build" / "test_notfound.py")
|
ensure_file(tmp_path / "build" / "test_notfound.py")
|
||||||
ensure_file(tmpdir / "dist" / "test_notfound.py")
|
ensure_file(tmp_path / "dist" / "test_notfound.py")
|
||||||
ensure_file(tmpdir / "_darcs" / "test_notfound.py")
|
ensure_file(tmp_path / "_darcs" / "test_notfound.py")
|
||||||
ensure_file(tmpdir / "CVS" / "test_notfound.py")
|
ensure_file(tmp_path / "CVS" / "test_notfound.py")
|
||||||
ensure_file(tmpdir / "{arch}" / "test_notfound.py")
|
ensure_file(tmp_path / "{arch}" / "test_notfound.py")
|
||||||
ensure_file(tmpdir / ".whatever" / "test_notfound.py")
|
ensure_file(tmp_path / ".whatever" / "test_notfound.py")
|
||||||
ensure_file(tmpdir / ".bzr" / "test_notfound.py")
|
ensure_file(tmp_path / ".bzr" / "test_notfound.py")
|
||||||
ensure_file(tmpdir / "normal" / "test_found.py")
|
ensure_file(tmp_path / "normal" / "test_found.py")
|
||||||
for x in Path(str(tmpdir)).rglob("test_*.py"):
|
for x in Path(str(tmp_path)).rglob("test_*.py"):
|
||||||
x.write_text("def test_hello(): pass", "utf-8")
|
x.write_text("def test_hello(): pass", "utf-8")
|
||||||
|
|
||||||
result = pytester.runpytest("--collect-only")
|
result = pytester.runpytest("--collect-only")
|
||||||
|
@ -226,10 +226,12 @@ class TestCollectFS:
|
||||||
norecursedirs = mydir xyz*
|
norecursedirs = mydir xyz*
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
tmpdir = pytester.path
|
tmp_path = pytester.path
|
||||||
ensure_file(tmpdir / "mydir" / "test_hello.py").write_text("def test_1(): pass")
|
ensure_file(tmp_path / "mydir" / "test_hello.py").write_text(
|
||||||
ensure_file(tmpdir / "xyz123" / "test_2.py").write_text("def test_2(): 0/0")
|
"def test_1(): pass"
|
||||||
ensure_file(tmpdir / "xy" / "test_ok.py").write_text("def test_3(): pass")
|
)
|
||||||
|
ensure_file(tmp_path / "xyz123" / "test_2.py").write_text("def test_2(): 0/0")
|
||||||
|
ensure_file(tmp_path / "xy" / "test_ok.py").write_text("def test_3(): pass")
|
||||||
rec = pytester.inline_run()
|
rec = pytester.inline_run()
|
||||||
rec.assertoutcome(passed=1)
|
rec.assertoutcome(passed=1)
|
||||||
rec = pytester.inline_run("xyz123/test_2.py")
|
rec = pytester.inline_run("xyz123/test_2.py")
|
||||||
|
@ -242,10 +244,10 @@ class TestCollectFS:
|
||||||
testpaths = gui uts
|
testpaths = gui uts
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
tmpdir = pytester.path
|
tmp_path = pytester.path
|
||||||
ensure_file(tmpdir / "env" / "test_1.py").write_text("def test_env(): pass")
|
ensure_file(tmp_path / "env" / "test_1.py").write_text("def test_env(): pass")
|
||||||
ensure_file(tmpdir / "gui" / "test_2.py").write_text("def test_gui(): pass")
|
ensure_file(tmp_path / "gui" / "test_2.py").write_text("def test_gui(): pass")
|
||||||
ensure_file(tmpdir / "uts" / "test_3.py").write_text("def test_uts(): pass")
|
ensure_file(tmp_path / "uts" / "test_3.py").write_text("def test_uts(): pass")
|
||||||
|
|
||||||
# executing from rootdir only tests from `testpaths` directories
|
# executing from rootdir only tests from `testpaths` directories
|
||||||
# are collected
|
# are collected
|
||||||
|
@ -255,7 +257,7 @@ class TestCollectFS:
|
||||||
# check that explicitly passing directories in the command-line
|
# check that explicitly passing directories in the command-line
|
||||||
# collects the tests
|
# collects the tests
|
||||||
for dirname in ("env", "gui", "uts"):
|
for dirname in ("env", "gui", "uts"):
|
||||||
items, reprec = pytester.inline_genitems(tmpdir.joinpath(dirname))
|
items, reprec = pytester.inline_genitems(tmp_path.joinpath(dirname))
|
||||||
assert [x.name for x in items] == ["test_%s" % dirname]
|
assert [x.name for x in items] == ["test_%s" % dirname]
|
||||||
|
|
||||||
# changing cwd to each subdirectory and running pytest without
|
# changing cwd to each subdirectory and running pytest without
|
||||||
|
@ -628,9 +630,9 @@ class TestSession:
|
||||||
|
|
||||||
class Test_getinitialnodes:
|
class Test_getinitialnodes:
|
||||||
def test_global_file(self, pytester: Pytester) -> None:
|
def test_global_file(self, pytester: Pytester) -> None:
|
||||||
tmpdir = pytester.path
|
tmp_path = pytester.path
|
||||||
x = ensure_file(tmpdir / "x.py")
|
x = ensure_file(tmp_path / "x.py")
|
||||||
with tmpdir.cwd():
|
with tmp_path.cwd():
|
||||||
config = pytester.parseconfigure(x)
|
config = pytester.parseconfigure(x)
|
||||||
col = pytester.getnode(config, x)
|
col = pytester.getnode(config, x)
|
||||||
assert isinstance(col, pytest.Module)
|
assert isinstance(col, pytest.Module)
|
||||||
|
@ -645,8 +647,8 @@ class Test_getinitialnodes:
|
||||||
The parent chain should match: Module<x.py> -> Package<subdir> -> Session.
|
The parent chain should match: Module<x.py> -> Package<subdir> -> Session.
|
||||||
Session's parent should always be None.
|
Session's parent should always be None.
|
||||||
"""
|
"""
|
||||||
tmpdir = pytester.path
|
tmp_path = pytester.path
|
||||||
subdir = tmpdir.joinpath("subdir")
|
subdir = tmp_path.joinpath("subdir")
|
||||||
x = ensure_file(subdir / "x.py")
|
x = ensure_file(subdir / "x.py")
|
||||||
ensure_file(subdir / "__init__.py")
|
ensure_file(subdir / "__init__.py")
|
||||||
with subdir.cwd():
|
with subdir.cwd():
|
||||||
|
|
Loading…
Reference in New Issue