@@ -686,23 +686,31 @@ def test_iterchildren_exclusions():
686
686
assert directory .parts [0 ] not in paths .unwanted_dirs
687
687
688
688
689
- def test_iterchildren_match (data_regression : DataRegressionFixture ):
689
+ @pytest .mark .parametrize ("absolute" , [True , False ])
690
+ def test_iterchildren_match (data_regression : DataRegressionFixture , absolute : bool ):
690
691
repo_path = PathPlus (__file__ ).parent .parent
691
- assert repo_path .is_dir ()
692
+ with in_directory ( repo_path .parent ):
692
693
693
- if (repo_path / "build" ).is_dir ():
694
- shutil .rmtree (repo_path / "build" )
694
+ assert repo_path .is_dir ()
695
695
696
- children = list (repo_path .iterchildren (match = "**/*.py" ))
697
- assert children
696
+ if not absolute :
697
+ repo_path = repo_path .relative_to (repo_path .parent )
698
+
699
+ if (repo_path / "build" ).is_dir ():
700
+ shutil .rmtree (repo_path / "build" )
701
+
702
+ children = list (repo_path .iterchildren (match = "**/*.py" ))
703
+ assert children
698
704
699
- child_paths = sorted (p .relative_to (repo_path ).as_posix () for p in children )
705
+ child_paths = sorted (p .relative_to (repo_path ).as_posix () for p in children )
700
706
701
- for exclude_filename in {".coverage" , "pathtype_demo.py" , "dist" , "htmlcov" , "conda" , ".idea" , "mutdef.py" }:
702
- if exclude_filename in child_paths :
703
- child_paths .remove (exclude_filename )
707
+ for exclude_filename in {
708
+ ".coverage" , "pathtype_demo.py" , "dist" , "htmlcov" , "conda" , ".idea" , "mutdef.py"
709
+ }:
710
+ if exclude_filename in child_paths :
711
+ child_paths .remove (exclude_filename )
704
712
705
- data_regression .check (child_paths )
713
+ data_regression .check (child_paths , basename = "test_iterchildren_match" )
706
714
707
715
708
716
def test_iterchildren_no_exclusions (tmp_pathplus : PathPlus ):
0 commit comments