]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-28655: Fix test bdb for isolate mode (GH-10220)
authorMaite Giménez <mgimenez@dsic.upv.es>
Mon, 29 Oct 2018 20:32:22 +0000 (21:32 +0100)
committerVictor Stinner <vstinner@redhat.com>
Mon, 29 Oct 2018 20:32:22 +0000 (21:32 +0100)
Fix test_bdb when running Python is isolated mode.

(cherry picked from commit c0799ec973530ad2492bb1d6c7287ffc428f0348)

Lib/test/test_bdb.py

index a366678697180fae7152af3d871bc312b01812d3..616c3a8649840c46828eaa91e3f351403851ab78 100644 (file)
@@ -526,13 +526,13 @@ def run_test(modules, set_list, skip=None):
     test.id = lambda : None
     test.expect_set = list(gen(repeat(()), iter(sl)))
     with create_modules(modules):
-        sys.path.append(os.getcwd())
         with TracerRun(test, skip=skip) as tracer:
             tracer.runcall(tfunc_import)
 
 @contextmanager
 def create_modules(modules):
     with test.support.temp_cwd():
+        sys.path.append(os.getcwd())
         try:
             for m in modules:
                 fname = m + '.py'
@@ -544,6 +544,7 @@ def create_modules(modules):
         finally:
             for m in modules:
                 test.support.forget(m)
+            sys.path.pop()
 
 def break_in_func(funcname, fname=__file__, temporary=False, cond=None):
     return 'break', (fname, None, temporary, cond, funcname)