]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] bpo-38671: Add test that `pathlib.Path.resolve()` returns an absolute path...
authorBarney Gale <barney.gale@gmail.com>
Fri, 21 May 2021 11:54:56 +0000 (12:54 +0100)
committerGitHub <noreply@github.com>
Fri, 21 May 2021 11:54:56 +0000 (04:54 -0700)
Issue should be fixed in [bpo-43757]()

Co-Authored-by: Tzu-ping Chung <uranusjr@gmail.com>
(cherry picked from commit 18f41c04ff4161531f4d08631059fd3ed37c0218)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Automerge-Triggered-By: GH:encukou
Lib/test/test_pathlib.py

index 55d63d539e550eba61b0e9464cb4613fb5e0c853..54b7977b43f2351e9554e4476048c4e3b641540f 100644 (file)
@@ -1799,6 +1799,16 @@ class _BasePathTest(object):
         # Non-strict
         self.assertEqual(r.resolve(strict=False), p / '3' / '4')
 
+    def test_resolve_nonexist_relative_issue38671(self):
+        p = self.cls('non', 'exist')
+
+        old_cwd = os.getcwd()
+        os.chdir(BASE)
+        try:
+            self.assertEqual(p.resolve(), self.cls(BASE, p))
+        finally:
+            os.chdir(old_cwd)
+
     def test_with(self):
         p = self.cls(BASE)
         it = p.iterdir()