From: Barney Gale Date: Thu, 20 May 2021 16:41:33 +0000 (+0100) Subject: bpo-38671: Add test that `pathlib.Path.resolve()` returns an absolute path. (GH-26184) X-Git-Tag: v3.11.0a1~1070 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=18f41c04ff4161531f4d08631059fd3ed37c0218;p=thirdparty%2FPython%2Fcpython.git bpo-38671: Add test that `pathlib.Path.resolve()` returns an absolute path. (GH-26184) Issue should be fixed in bpo-43757 Co-Authored-by: Tzu-ping Chung --- diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 55d63d539e55..54b7977b43f2 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -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()