mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-38901: Allow setting a venv's prompt to the basename of the current directory. (GH-17946)
When a prompt value of '.' is specified, os.path.basename(os.getcwd()) is used to configure the prompt for the created venv.
This commit is contained in:
parent
4b0d91aab4
commit
7d6378051f
4 changed files with 16 additions and 1 deletions
|
@ -138,6 +138,15 @@ class BasicTest(BaseTest):
|
|||
self.assertEqual(context.prompt, '(My prompt) ')
|
||||
self.assertIn("prompt = 'My prompt'\n", data)
|
||||
|
||||
rmtree(self.env_dir)
|
||||
builder = venv.EnvBuilder(prompt='.')
|
||||
cwd = os.path.basename(os.getcwd())
|
||||
self.run_with_capture(builder.create, self.env_dir)
|
||||
context = builder.ensure_directories(self.env_dir)
|
||||
data = self.get_text_file_contents('pyvenv.cfg')
|
||||
self.assertEqual(context.prompt, '(%s) ' % cwd)
|
||||
self.assertIn("prompt = '%s'\n" % cwd, data)
|
||||
|
||||
def test_upgrade_dependencies(self):
|
||||
builder = venv.EnvBuilder()
|
||||
bin_path = 'Scripts' if sys.platform == 'win32' else 'bin'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue