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

Move from tox to Nox #10693

Merged
merged 11 commits into from
Dec 3, 2021
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2

- run: pip install vendoring
- run: vendoring sync . --verbose
- run: pip install nox
- run: nox -s vendoring
- run: git diff --exit-code

tests-unix:
Expand Down Expand Up @@ -121,17 +121,17 @@ jobs:
if: matrix.os == 'MacOS'
run: brew install bzr

- run: pip install tox 'virtualenv<20'
- run: pip install nox 'virtualenv<20'

# Main check
- name: Run unit tests
run: >-
tox -e py --
nox -s test-${{ matrix.python }} --
-m unit
--verbose --numprocesses auto --showlocals
- name: Run integration tests
run: >-
tox -e py --
nox -s test-${{ matrix.python }} --
-m integration
--verbose --numprocesses auto --showlocals
--durations=5
Expand Down Expand Up @@ -178,15 +178,15 @@ jobs:
$acl.AddAccessRule($rule)
Set-Acl "R:\Temp" $acl

- run: pip install tox 'virtualenv<20'
- run: pip install nox 'virtualenv<20'
env:
TEMP: "R:\\Temp"

# Main check
- name: Run unit tests
if: matrix.group == 1
run: >-
tox -e py --
nox -s test-${{ matrix.python }} --
-m unit
--verbose --numprocesses auto --showlocals
env:
Expand All @@ -195,7 +195,7 @@ jobs:
- name: Run integration tests (group 1)
if: matrix.group == 1
run: >-
tox -e py --
nox -s test-${{ matrix.python }} --
-m integration -k "not test_install"
--verbose --numprocesses auto --showlocals
env:
Expand All @@ -204,7 +204,7 @@ jobs:
- name: Run integration tests (group 2)
if: matrix.group == 2
run: >-
tox -e py --
nox -s test-${{ matrix.python }} --
-m integration -k "test_install"
--verbose --numprocesses auto --showlocals
env:
Expand Down
28 changes: 14 additions & 14 deletions docs/html/development/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Development Environment
pip is a command line application written in Python. For developing pip,
you should `install Python`_ on your computer.

For developing pip, you need to install :pypi:`tox`. Often, you can run
``python -m pip install tox`` to install and use it.
For developing pip, you need to install :pypi:`nox`. Often, you can run
``python -m pip install nox`` to install and use it.


Running pip From Source Tree
Expand Down Expand Up @@ -60,7 +60,7 @@ Running Tests
=============

pip's tests are written using the :pypi:`pytest` test framework and
:mod:`unittest.mock`. :pypi:`tox` is used to automate the setup and execution
:mod:`unittest.mock`. :pypi:`nox` is used to automate the setup and execution
of pip's tests.

It is preferable to run the tests in parallel for better experience during development,
Expand All @@ -70,29 +70,29 @@ To run tests:

.. code-block:: console

$ tox -e py310 -- -n auto
$ nox -s test-3.10 -- -n auto

To run tests without parallelization, run:

.. code-block:: console

$ tox -e py310
$ nox -s test-3.10

The example above runs tests against Python 3.10. You can also use other
versions like ``py39`` and ``pypy3``.
versions like ``3.9`` and ``pypy3``.

``tox`` has been configured to forward any additional arguments it is given to
``nox`` has been configured to forward any additional arguments it is given to
``pytest``. This enables the use of pytest's `rich CLI`_. As an example, you
can select tests using the various ways that pytest provides:

.. code-block:: console

$ # Using file name
$ tox -e py310 -- tests/functional/test_install.py
$ nox -s test-3.10 -- tests/functional/test_install.py
$ # Using markers
$ tox -e py310 -- -m unit
$ nox -s test-3.10 -- -m unit
$ # Using keywords
$ tox -e py310 -- -k "install and not wheel"
$ nox -s test-3.10 -- -k "install and not wheel"

Running pip's entire test suite requires supported version control tools
(subversion, bazaar, git, and mercurial) to be installed. If you are missing
Expand All @@ -101,8 +101,8 @@ explicitly tell pytest to skip those tests:

.. code-block:: console

$ tox -e py310 -- -k "not svn"
$ tox -e py310 -- -k "not (svn or git)"
$ nox -s test-3.10 -- -k "not svn"
$ nox -s test-3.10 -- -k "not (svn or git)"


Running Linters
Expand All @@ -116,7 +116,7 @@ To use linters locally, run:

.. code-block:: console

$ tox -e lint
$ nox -s lint

.. note::

Expand Down Expand Up @@ -155,7 +155,7 @@ To build it locally, run:

.. code-block:: console

$ tox -e docs
$ nox -s docs

The built documentation can be found in the ``docs/build`` folder.

Expand Down
1 change: 1 addition & 0 deletions news/10693.process.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace all our tox operations with Nox.
18 changes: 15 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ def should_update_common_wheels() -> bool:

# -----------------------------------------------------------------------------
DiddiLeija marked this conversation as resolved.
Show resolved Hide resolved
# Development Commands
# These are currently prototypes to evaluate whether we want to switch over
# completely to nox for all our automation. Contributors should prefer using
# `tox -e ...` until this note is removed.
# -----------------------------------------------------------------------------
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "pypy3"])
def test(session: nox.Session) -> None:
Expand Down Expand Up @@ -223,6 +220,21 @@ def pinned_requirements(path: Path) -> Iterator[Tuple[str, str]]:
release.commit_file(session, ".", message=message)


@nox.session
def coverage(session: nox.Session) -> None:
if not os.path.exists("./.coverage-output"):
os.mkdir("./.coverage-output")
session.run(
"pytest",
"--cov=pip",
"--cov-config=./setup.cfg",
env={
"COVERAGE_OUTPUT_DIR": "./.coverage-output",
"COVERAGE_PROCESS_START": "./setup.cfg",
},
)


# -----------------------------------------------------------------------------
# Release Commands
# -----------------------------------------------------------------------------
Expand Down
74 changes: 0 additions & 74 deletions tox.ini

This file was deleted.