@@ -686,23 +686,31 @@ def test_iterchildren_exclusions():
686686 assert directory .parts [0 ] not in paths .unwanted_dirs
687687
688688
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 ):
690691 repo_path = PathPlus (__file__ ).parent .parent
691- assert repo_path .is_dir ()
692+ with in_directory ( repo_path .parent ):
692693
693- if (repo_path / "build" ).is_dir ():
694- shutil .rmtree (repo_path / "build" )
694+ assert repo_path .is_dir ()
695695
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
698704
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 )
700706
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 )
704712
705- data_regression .check (child_paths )
713+ data_regression .check (child_paths , basename = "test_iterchildren_match" )
706714
707715
708716def test_iterchildren_no_exclusions (tmp_pathplus : PathPlus ):
0 commit comments