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 26, 2018
commit f836691283624361ee12722c8ba469f7cfe86cd1
5 changes: 3 additions & 2 deletions Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ def tearDownClass(cls):
class CurrentDirTests(unittest.TestCase):

def setUp(self):
self.pwd = os.environ['PWD']
self.pwd = os.environ.get('PWD')
base = os.path.abspath(support.TESTFN)
self.tmp_dir = base + '_dir'
self.tmp_lnk = base + '_lnk'
Expand Down Expand Up @@ -1291,7 +1291,8 @@ def test_get_current_dir_name(self):
os.unlink(self.tmp_lnk)

def tearDown(self):
os.environ['PWD'] = self.pwd
if self.pwd is not None:
os.environ['PWD'] = self.pwd


class RemoveDirsTests(unittest.TestCase):
Expand Down