@@ -690,6 +690,9 @@ def test_iterchildren_match(data_regression: DataRegressionFixture):
690690 repo_path = PathPlus (__file__ ).parent .parent
691691 assert repo_path .is_dir ()
692692
693+ if (repo_path / "build" ).is_dir ():
694+ shutil .rmtree (repo_path / "build" )
695+
693696 children = list (repo_path .iterchildren (match = "**/*.py" ))
694697 assert children
695698
@@ -802,3 +805,40 @@ def test_iterchildren_no_exclusions(tmp_pathplus: PathPlus):
802805 )
803806def test_globpath (pattern : str , filename : str , match : bool ):
804807 assert matchglob (filename , pattern ) is match
808+
809+
810+ def test_abspath (tmp_pathplus : PathPlus ):
811+ assert (tmp_pathplus / "foo" / "bar" / "baz" / ".." ).abspath () == tmp_pathplus / "foo" / "bar"
812+
813+ file = tmp_pathplus / "foo" / "bar.py"
814+ file .parent .mkdir (parents = True )
815+ file .write_text ("I'm the original" )
816+
817+ link = tmp_pathplus / "baz.py"
818+ os .symlink (file , link )
819+
820+ assert link .read_text () == "I'm the original"
821+ assert link .is_symlink ()
822+ assert link .resolve () == file
823+ assert link .abspath () == link
824+
825+ file .unlink ()
826+ file .parent .rmdir ()
827+
828+ assert isinstance ((tmp_pathplus / "foo" / "bar" / "baz" / ".." ).abspath (), PathPlus )
829+
830+
831+ def test_abspath_dotted (tmp_pathplus : PathPlus ):
832+
833+ file = tmp_pathplus / "baz.py"
834+ file .write_text ("I'm the original" )
835+
836+ link = tmp_pathplus / "bar" / "foo.py"
837+ link .parent .mkdir (parents = True )
838+
839+ os .symlink (os .path .join (link .parent , ".." , "baz.py" ), link )
840+
841+ assert link .read_text () == "I'm the original"
842+ assert link .is_symlink ()
843+ assert link .resolve () == file
844+ assert link .abspath () == link
0 commit comments