Browse Source

Go back to old cwd after running doctests.

Jelmer Vernooij 13 năm trước cách đây
mục cha
commit
354b1005bc
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      dulwich/tests/__init__.py

+ 2 - 0
dulwich/tests/__init__.py

@@ -104,10 +104,12 @@ def tutorial_test_suite():
         ]
     tutorial_files = ["../../docs/tutorial/%s.txt" % name for name in tutorial]
     def setup(test):
+        test.__old_cwd = os.getcwd()
         test.__dulwich_tempdir = tempfile.mkdtemp()
         os.chdir(test.__dulwich_tempdir)
     def teardown(test):
         shutil.rmtree(test.__dulwich_tempdir)
+        os.chdir(test.__old_cwd)
     return doctest.DocFileSuite(setUp=setup, tearDown=teardown,
         *tutorial_files)