MCPcopy Index your code
hub / github.com/python/cpython / test_upgrade

Method test_upgrade

Lib/test/test_venv.py:421–440  ·  view source on GitHub ↗

Test upgrading an existing environment directory.

(self)

Source from the content-addressed store, hash-verified

419 self.clear_directory(self.env_dir)
420
421 def test_upgrade(self):
422 """
423 Test upgrading an existing environment directory.
424 """
425 # See Issue #21643: the loop needs to run twice to ensure
426 # that everything works on the upgrade (the first run just creates
427 # the venv).
428 for upgrade in (False, True):
429 builder = venv.EnvBuilder(upgrade=upgrade)
430 self.run_with_capture(builder.create, self.env_dir)
431 self.isdir(self.bindir)
432 self.isdir(self.include)
433 self.isdir(*self.lib)
434 fn = self.get_env_file(self.bindir, self.exe)
435 if not os.path.exists(fn):
436 # diagnostics for Windows buildbot failures
437 bd = self.get_env_file(self.bindir)
438 print('Contents of %r:' % bd)
439 print(' %r' % os.listdir(bd))
440 self.assertTrue(os.path.exists(fn), 'File %r should exist.' % fn)
441
442 def test_isolation(self):
443 """

Callers

nothing calls this directly

Calls 6

isdirMethod · 0.95
run_with_captureMethod · 0.80
get_env_fileMethod · 0.80
listdirMethod · 0.80
assertTrueMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected