We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b50ae9 commit 7adcf89Copy full SHA for 7adcf89
1 file changed
test/test_utils.py
@@ -806,6 +806,17 @@ def test_exit(self):
806
with self.assertRaises(RuntimeError):
807
do_command(args, HERE)
808
809
+ def test_restore_cwd(self):
810
+ "Ensure do_command in a different cwd restores cwd after error."
811
+ before = os.getcwd()
812
+ # after = None
813
+ try:
814
+ do_command(cmd=['ls /does-not-exist'], cwd=os.path.dirname(before))
815
+ except RuntimeError as exc:
816
+ pass
817
+ finally:
818
+ after = os.getcwd()
819
+ self.assertEqual(before, after)
820
821
class FlattenTest(unittest.TestCase):
822
def test_good(self):
0 commit comments