From 08752637f495d743df7f88f3ec1740d1bc1bdbbd Mon Sep 17 00:00:00 2001 From: Eric Lin Date: Tue, 4 Aug 2020 14:08:37 -0400 Subject: [PATCH] Removed remaining usages and examples with tox. Updated references to tox to reference to nox instead. --- MANIFEST.in | 2 +- plugins/ext_test/noxfile.py | 7 +++++++ plugins/ext_test/tasks.py | 2 +- plugins/tasks.py | 2 +- plugins/template/README.md | 10 +++++----- plugins/template/noxfile.py | 7 +++++++ plugins/template/tasks.py | 2 +- setup.py | 4 ++-- tasks.py | 23 +---------------------- 9 files changed, 26 insertions(+), 33 deletions(-) create mode 100644 plugins/ext_test/noxfile.py create mode 100644 plugins/template/noxfile.py diff --git a/MANIFEST.in b/MANIFEST.in index 734f73ad4..f0b53367c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 * diff --git a/plugins/ext_test/noxfile.py b/plugins/ext_test/noxfile.py new file mode 100644 index 000000000..85411106a --- /dev/null +++ b/plugins/ext_test/noxfile.py @@ -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') diff --git a/plugins/ext_test/tasks.py b/plugins/ext_test/tasks.py index ffa55e61e..f23faa69b 100644 --- a/plugins/ext_test/tasks.py +++ b/plugins/ext_test/tasks.py @@ -41,7 +41,7 @@ def rmrf(items, verbose=True): ##### # -# pytest, tox, pylint, and codecov +# pytest, pylint, and codecov # ##### diff --git a/plugins/tasks.py b/plugins/tasks.py index 26ec1adb5..1a70e4f20 100644 --- a/plugins/tasks.py +++ b/plugins/tasks.py @@ -22,7 +22,7 @@ ##### # -# pytest, tox, pylint, and codecov +# pytest, pylint, and codecov # ##### diff --git a/plugins/template/README.md b/plugins/template/README.md index 327a226eb..8a423f064 100644 --- a/plugins/template/README.md +++ b/plugins/template/README.md @@ -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 @@ -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 @@ -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 ``` diff --git a/plugins/template/noxfile.py b/plugins/template/noxfile.py new file mode 100644 index 000000000..85411106a --- /dev/null +++ b/plugins/template/noxfile.py @@ -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') diff --git a/plugins/template/tasks.py b/plugins/template/tasks.py index dcde18047..6abec40d8 100644 --- a/plugins/template/tasks.py +++ b/plugins/template/tasks.py @@ -36,7 +36,7 @@ def rmrf(items, verbose=True): ##### # -# pytest, tox, pylint, and codecov +# pytest, pylint, and codecov # ##### diff --git a/setup.py b/setup.py index cde2db71e..4feeb1265 100755 --- a/setup.py +++ b/setup.py @@ -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', @@ -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', ] diff --git a/tasks.py b/tasks.py index eef310eca..7dd286aca 100644 --- a/tasks.py +++ b/tasks.py @@ -46,7 +46,7 @@ def rmrf(items, verbose=True): ##### # -# pytest, tox, nox, pylint, and codecov +# pytest, nox, pylint, and codecov # ##### @@ -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"""