Skip to content
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
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include LICENSE README.md CHANGELOG.md CONTRIBUTING.md tox.ini noxfile.py Pipfile
include LICENSE README.md CHANGELOG.md CONTRIBUTING.md noxfile.py Pipfile
recursive-include examples *
recursive-include tests *
recursive-include docs *
Expand Down
7 changes: 7 additions & 0 deletions plugins/ext_test/noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import nox


@nox.session(python=['3.5', '3.6', '3.7', '3.8', '3.9'])
def tests(session):
session.install('invoke', './[test]')
session.run('invoke', 'pytest', '--junit', '--no-pty')
2 changes: 1 addition & 1 deletion plugins/ext_test/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def rmrf(items, verbose=True):

#####
#
# pytest, tox, pylint, and codecov
# pytest, pylint, and codecov
#
#####

Expand Down
2 changes: 1 addition & 1 deletion plugins/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#####
#
# pytest, tox, pylint, and codecov
# pytest, pylint, and codecov
#
#####

Expand Down
10 changes: 5 additions & 5 deletions plugins/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ python supported by cmd2, and all supported platforms. cmd2 uses a three
tiered testing strategy to accomplish this objective.

- [pytest](https://pytest.org) runs the unit tests
- [tox](https://tox.readthedocs.io/) runs the unit tests on multiple versions
- [nox](https://nox.thea.codes/en/stable/) runs the unit tests on multiple versions
of python
- [AppVeyor](https://www.appveyor.com/) and [TravisCI](https://travis-ci.com)
run the tests on the various supported platforms
Expand All @@ -218,7 +218,7 @@ This plugin template is set up to use the same strategy.

### Create python environments

This project uses [tox](https://tox.readthedocs.io/en/latest/) to run the test
This project uses [nox](https://nox.thea.codes/en/stable/) to run the test
suite against multiple python versions. I recommend
[pyenv](https://github.com/pyenv/pyenv) with the
[pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv>) plugin to manage
Expand Down Expand Up @@ -296,12 +296,12 @@ Run `invoke pytest` from the top level directory of your plugin to run all the
unit tests found in the `tests` directory.


### Use tox to run unit tests in multiple versions of python
### Use nox to run unit tests in multiple versions of python

The included `tox.ini` is setup to run the unit tests in python 3.4, 3.5, 3.6,
The included `noxfile.py` is setup to run the unit tests in python 3.4, 3.5, 3.6,
and 3.7. You can run your unit tests in all of these versions of python by:
```
$ invoke tox
$ nox
```


Expand Down
7 changes: 7 additions & 0 deletions plugins/template/noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import nox


@nox.session(python=['3.5', '3.6', '3.7', '3.8', '3.9'])
def tests(session):
session.install('invoke', './[test]')
session.run('invoke', 'pytest', '--junit', '--no-pty')
2 changes: 1 addition & 1 deletion plugins/template/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def rmrf(items, verbose=True):

#####
#
# pytest, tox, pylint, and codecov
# pytest, pylint, and codecov
#
#####

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
":sys_platform=='win32'": ['pyreadline'],
# Extra dependencies for running unit tests
'test': [
"gnureadline; sys_platform=='darwin'", # include gnureadline on macOS to ensure it is available in tox env
"gnureadline; sys_platform=='darwin'", # include gnureadline on macOS to ensure it is available in nox env
"mock ; python_version<'3.6'", # for python 3.5 we need the third party mock module
'codecov',
'coverage',
Expand All @@ -57,7 +57,7 @@
],
# development only dependencies: install with 'pip install -e .[dev]'
'dev': ["mock ; python_version<'3.6'", # for python 3.5 we need the third party mock module
'pytest', 'codecov', 'pytest-cov', 'pytest-mock', 'tox', 'nox', 'flake8',
'pytest', 'codecov', 'pytest-cov', 'pytest-mock', 'nox', 'flake8',
'sphinx', 'sphinx-rtd-theme', 'sphinx-autobuild', 'doc8',
'invoke', 'twine>=1.11',
]
Expand Down
23 changes: 1 addition & 22 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def rmrf(items, verbose=True):

#####
#
# pytest, tox, nox, pylint, and codecov
# pytest, nox, pylint, and codecov
#
#####

Expand Down Expand Up @@ -114,27 +114,6 @@ def mypy_clean(context):
namespace_clean.add_task(mypy_clean, 'mypy')


@invoke.task
def tox(context):
"""Run unit and integration tests on multiple python versions using tox"""
with context.cd(TASK_ROOT_STR):
context.run("tox")


namespace.add_task(tox)


@invoke.task
def tox_clean(context):
"""Remove tox virtualenvs and logs"""
# pylint: disable=unused-argument
with context.cd(TASK_ROOT_STR):
rmrf('.tox')


namespace_clean.add_task(tox_clean, 'tox')


@invoke.task
def nox_clean(context):
"""Remove nox virtualenvs and logs"""
Expand Down