Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require passing a destination directory #1568

Merged
merged 1 commit into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/1568.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Passing in the virtual environment name/path is now required (no longer defaults to ``venv``) - by :user:`gaborbernat`.
4 changes: 2 additions & 2 deletions docs/cli_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ CLI flags

It modifies the environment variables in a shell to create an isolated Python environment, so you'll need to have a
shell to run it. You can type in ``virtualenv`` (name of the application) followed by flags that control its
behaviour. All options have sensible defaults, so you'll get a working virtual environment in a ``venv`` folder even
if you don't pass any options. The default values for the command line options can be overridden via the
behaviour. All options have sensible defaults, and there's one required argument: then name/path of the virtual
environment to create. The default values for the command line options can be overridden via the
:ref:`conf_file` or :ref:`env_vars`. Environment variables takes priority over the configuration file values
(``--help`` will show if a default comes from the environment variable as the help message will end in this case
with environment variables or the configuration file).
Expand Down
2 changes: 1 addition & 1 deletion src/virtualenv/create/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def add_parser_arguments(cls, parser, interpreter, meta):
:param meta: value as returned by :meth:`can_create`
"""
parser.add_argument(
"dest", help="directory to create virtualenv at", type=cls.validate_dest, default="venv", nargs="?",
"dest", help="directory to create virtualenv at", type=cls.validate_dest,
)
parser.add_argument(
"--clear",
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/config/test_env_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ def empty_conf(tmp_path, monkeypatch):

def test_value_ok(monkeypatch, empty_conf):
monkeypatch.setenv(str("VIRTUALENV_VERBOSE"), str("5"))
result = parse_cli([])
result = parse_cli(["venv"])
assert result.verbosity == 5


def test_value_bad(monkeypatch, caplog, empty_conf):
monkeypatch.setenv(str("VIRTUALENV_VERBOSE"), str("a"))
result = parse_cli([])
result = parse_cli(["venv"])
assert result.verbosity == 2
assert len(caplog.messages) == 1
assert "env var VIRTUALENV_VERBOSE failed to convert" in caplog.messages[0]
Expand Down