Exemple #1
0
    def test_chdir_path(self):
        """Temporarily change the working directory to Path path"""
        dirname = Path('newdirectory')
        with self.runner.isolated_filesystem():
            dirname.mkdir()

            cwd = os.getcwd()

            with pew.chdir(dirname):
                assert os.getcwd() == os.path.join(cwd, str(dirname))

            assert os.getcwd() == cwd
Exemple #2
0
    def test_chdir_string(self):
        """Temporarily change the working directory to string path"""
        dirname = 'newdirectory'
        with self.runner.isolated_filesystem():
            Path(dirname).mkdir()

            cwd = os.getcwd()

            with pew.chdir(dirname):
                assert os.getcwd() == os.path.join(cwd, dirname)

            assert os.getcwd() == cwd