Skip to content
Prev Previous commit
Next Next commit
fixup! bpo-1154351: add get_current_dir_name() to os module
  • Loading branch information
bradengroom committed Oct 27, 2018
commit d49fdf3ef1437de6a3c1ff1875b0246a8ac72458
10 changes: 6 additions & 4 deletions Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,13 +1269,15 @@ def test_getcwd(self):
os.symlink(self.tmp_dir, self.tmp_lnk, True)
os.chdir(self.tmp_lnk)
if os.name == 'nt':
self.assertEqual(os.getcwd(), self.tmp_lnk)
# windows doesn't dereference the path
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is a bug or the expected behavior. I haven't used windows in quite some time, but this is the behavior I'm seeing in CI.

expected_cwd = self.tmp_lnk
else:
self.assertEqual(os.getcwd(), self.tmp_dir)
expected_cwd = self.tmp_dir
self.assertEqual(os.getcwd(), expected_cwd)
with mock.patch.dict('os.environ', {'PWD': self.tmp_dir}):
self.assertEqual(os.getcwd(), self.tmp_dir)
self.assertEqual(os.getcwd(), expected_cwd)
with mock.patch.dict('os.environ', {'PWD': self.tmp_lnk}):
self.assertEqual(os.getcwd(), self.tmp_dir)
self.assertEqual(os.getcwd(), expected_cwd)

def test_get_current_dir_name(self):
# os.get_current_dir_name() returns the direct path--mirroring
Expand Down