def test_chdir(self): testfn = self.get_testfn() base = os.getcwd() os.mkdir(testfn) with chdir(testfn): self.assertEqual(os.getcwd(), os.path.join(base, testfn)) self.assertEqual(os.getcwd(), base)
def test_proc_cwd(self): safe_mkdir(self.funky_name) with chdir(self.funky_name): p = psutil.Process() cwd = p.cwd() self.assertIsInstance(p.cwd(), str) if self.expect_exact_path_match(): self.assertEqual(cwd, self.funky_name)
def test_proc_cwd(self): dname = self.funky_name + "2" self.addCleanup(safe_rmpath, dname) safe_mkdir(dname) with chdir(dname): p = psutil.Process() cwd = p.cwd() self.assertIsInstance(p.cwd(), str) if self.expect_exact_path_match(): self.assertEqual(cwd, dname)
def test_chdir(self): base = os.getcwd() os.mkdir(TESTFN) with chdir(TESTFN): self.assertEqual(os.getcwd(), os.path.join(base, TESTFN)) self.assertEqual(os.getcwd(), base)