Esempio n. 1
0
    def test_pushd_converts_pathlib_path(self, mock_convert):
        path = Path('/other/path')
        mock_convert.return_value = str(path)

        shell.pushd(path)

        mock_convert.assert_called_with(path)
Esempio n. 2
0
    def test_pushd_echos_fake_pushd_popd_commands(self, mock_stdout):
        with shell.pushd('/other/path', echo=True):
            pass

        self.assertEqual(mock_stdout.getvalue().splitlines(),
                         ['>>> pushd /other/path', '>>> popd'])
Esempio n. 3
0
    def test_pushd_restores_cwd(self, mock_chdir):
        with shell.pushd('/other/path'):
            mock_chdir.assert_called_with('/other/path')

        mock_chdir.assert_called_with('/start/path')