Refactor test
This commit is contained in:
parent
58c5d5089a
commit
12cba4a50b
|
@ -117,9 +117,9 @@ class TestConfigTmpPath:
|
|||
|
||||
root = pytester._test_tmproot
|
||||
for child in root.iterdir():
|
||||
base_dir = filter(lambda x: x.is_dir(), child.iterdir())
|
||||
base_dir = list(child.iterdir())
|
||||
# Check the base dir itself is gone without depending on test results
|
||||
assert len(list(base_dir)) == 0
|
||||
assert base_dir == []
|
||||
|
||||
@pytest.mark.parametrize("policy", ["failed", "all"])
|
||||
@pytest.mark.parametrize("count", [0, 1, 3])
|
||||
|
@ -157,7 +157,6 @@ class TestConfigTmpPath:
|
|||
root = pytester._test_tmproot
|
||||
for child in root.iterdir():
|
||||
base_dir = filter(lambda x: not x.is_symlink(), child.iterdir())
|
||||
# Check the base dir itself is gone
|
||||
assert len(list(base_dir)) == count
|
||||
|
||||
def test_policy_failed_removes_only_passed_dir(self, pytester: Pytester) -> None:
|
||||
|
@ -200,9 +199,9 @@ class TestConfigTmpPath:
|
|||
pytester.inline_run(p)
|
||||
root = pytester._test_tmproot
|
||||
for child in root.iterdir():
|
||||
base_dir = filter(lambda x: x.is_dir(), child.iterdir())
|
||||
base_dir = list(child.iterdir())
|
||||
# Check the base dir itself is gone
|
||||
assert len(list(base_dir)) == 0
|
||||
assert base_dir == []
|
||||
|
||||
# issue #10502
|
||||
def test_policy_failed_removes_dir_when_skipped_from_fixture(
|
||||
|
@ -225,10 +224,8 @@ class TestConfigTmpPath:
|
|||
# Check if the whole directory is removed
|
||||
root = pytester._test_tmproot
|
||||
for child in root.iterdir():
|
||||
base_dir = list(
|
||||
filter(lambda x: x.is_dir() and not x.is_symlink(), child.iterdir())
|
||||
)
|
||||
assert len(base_dir) == 0
|
||||
base_dir = list(child.iterdir())
|
||||
assert base_dir == []
|
||||
|
||||
# issue #10502
|
||||
def test_policy_all_keeps_dir_when_skipped_from_fixture(
|
||||
|
|
Loading…
Reference in New Issue