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

Allow not passing "--upgrade" to session.install #172

Merged
merged 2 commits into from
Mar 22, 2019
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
6 changes: 3 additions & 3 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If you run this via ``nox`` you should see output similar to this::

nox > Running session lint
nox > virtualenv /tmp/example/.nox/lint
nox > pip install --upgrade flake8
nox > pip install flake8
nox > flake8
nox > Session lint successful. :)

Expand Down Expand Up @@ -149,10 +149,10 @@ When you run ``nox``, it will create a two distinct sessions::

$ nox
nox > Running session tests(django='1.9')
nox > pip install --upgrade django==1.9
nox > pip install django==1.9
...
nox > Running session tests(djano='2.0')
nox > pip install --upgrade django==2.0
nox > pip install django==2.0


:func:`nox.parametrize` has an interface and usage intentionally similar to `pytest's parametrize <https://pytest.org/latest/parametrize.html#_pytest.python.Metafunc.parametrize>`_.
Expand Down
4 changes: 2 additions & 2 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ Would run both ``install`` commands, but skip the ``run`` command::

nox > Running session tests
nox > Creating virtualenv using python3.7 in ./.nox/tests
nox > pip install --upgrade pytest
nox > pip install --upgrade .
nox > pip install pytest
nox > pip install .
nox > Skipping pytest run, as --install-only is set.
nox > Session tests was successful.

Expand Down
2 changes: 1 addition & 1 deletion nox/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def install(self, *args, **kwargs):
if "silent" not in kwargs:
kwargs["silent"] = True

self._run("pip", "install", "--upgrade", *args, external="error", **kwargs)
self._run("pip", "install", *args, external="error", **kwargs)

def notify(self, target):
"""Place the given session at the end of the queue.
Expand Down
18 changes: 3 additions & 15 deletions tests/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_run_install_only_should_install(self):
session.run("spam", "eggs")

run.assert_called_once_with(
("pip", "install", "--upgrade", "spam"),
("pip", "install", "spam"),
env=mock.ANY,
external=mock.ANY,
path=mock.ANY,
Expand Down Expand Up @@ -220,13 +220,7 @@ class SessionNoSlots(nox.sessions.Session):
with mock.patch.object(session, "_run", autospec=True) as run:
session.install("requests", "urllib3")
run.assert_called_once_with(
"pip",
"install",
"--upgrade",
"requests",
"urllib3",
silent=True,
external="error",
"pip", "install", "requests", "urllib3", silent=True, external="error"
)

def test_install_non_default_kwargs(self):
Expand All @@ -248,13 +242,7 @@ class SessionNoSlots(nox.sessions.Session):
with mock.patch.object(session, "_run", autospec=True) as run:
session.install("requests", "urllib3", silent=False)
run.assert_called_once_with(
"pip",
"install",
"--upgrade",
"requests",
"urllib3",
silent=False,
external="error",
"pip", "install", "requests", "urllib3", silent=False, external="error"
)

def test_notify(self):
Expand Down