From bee72a66228762a220474445c9bf019600105528 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 8 Nov 2018 20:35:53 +0100 Subject: [PATCH 01/11] Fix nodes._check_initialpaths_for_relpath for dirs Ref: https://github.com/pytest-dev/pytest/issues/4321#issuecomment-436951894 Hardens some of the not many tests affected by this: 1. `testing/test_session.py::test_rootdir_option_arg` displayed: > root/test_rootdir_option_arg2/test_rootdir_option_arg.py 2. `test_cmdline_python_namespace_package` displayed "hello/" prefix for: > hello/test_hello.py::test_hello > hello/test_hello.py::test_other --- src/_pytest/nodes.py | 2 +- testing/acceptance_test.py | 10 +++++----- testing/test_nodes.py | 22 ++++++++++++++++++++++ testing/test_session.py | 6 +++++- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py index 76d8d6a8a..032d4e1d2 100644 --- a/src/_pytest/nodes.py +++ b/src/_pytest/nodes.py @@ -447,7 +447,7 @@ class Collector(Node): def _check_initialpaths_for_relpath(session, fspath): for initial_path in session._initialpaths: if fspath.common(initial_path) == initial_path: - return fspath.relto(initial_path.dirname) + return fspath.relto(initial_path) class FSCollector(Collector): diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 19d7946cf..315bd570a 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -663,11 +663,11 @@ class TestInvocationVariants(object): assert result.ret == 0 result.stdout.fnmatch_lines( [ - "*test_hello.py::test_hello*PASSED*", - "*test_hello.py::test_other*PASSED*", - "*test_world.py::test_world*PASSED*", - "*test_world.py::test_other*PASSED*", - "*4 passed*", + "test_hello.py::test_hello*PASSED*", + "test_hello.py::test_other*PASSED*", + "ns_pkg/world/test_world.py::test_world*PASSED*", + "ns_pkg/world/test_world.py::test_other*PASSED*", + "*4 passed in*", ] ) diff --git a/testing/test_nodes.py b/testing/test_nodes.py index d55184ef2..0a7f7ec6f 100644 --- a/testing/test_nodes.py +++ b/testing/test_nodes.py @@ -1,3 +1,5 @@ +import py + import pytest from _pytest import nodes @@ -29,3 +31,23 @@ def test_std_warn_not_pytestwarning(testdir): ) with pytest.raises(ValueError, match=".*instance of PytestWarning.*"): items[0].warn(UserWarning("some warning")) + + +def test__check_initialpaths_for_relpath(): + """Ensure that it handles dirs, and does not always use dirname.""" + cwd = py.path.local() + + class FakeSession: + _initialpaths = [cwd] + + assert nodes._check_initialpaths_for_relpath(FakeSession, cwd) == "" + + sub = cwd.join("file") + + class FakeSession: + _initialpaths = [cwd] + + assert nodes._check_initialpaths_for_relpath(FakeSession, sub) == "file" + + outside = py.path.local("/outside") + assert nodes._check_initialpaths_for_relpath(FakeSession, outside) is None diff --git a/testing/test_session.py b/testing/test_session.py index c1785b916..746618308 100644 --- a/testing/test_session.py +++ b/testing/test_session.py @@ -323,7 +323,11 @@ def test_rootdir_option_arg(testdir, monkeypatch, path): result = testdir.runpytest("--rootdir={}".format(path)) result.stdout.fnmatch_lines( - ["*rootdir: {}/root, inifile:*".format(testdir.tmpdir), "*1 passed*"] + [ + "*rootdir: {}/root, inifile:*".format(testdir.tmpdir), + "root/test_rootdir_option_arg.py *", + "*1 passed*", + ] ) From b51c1c3b8da92c670766fe2fec43f2332bfe7c70 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 9 Nov 2018 04:01:26 +0100 Subject: [PATCH 02/11] tests: fix equal_with_bash for .coverage files Fixes https://github.com/pytest-dev/pytest/issues/4162. --- testing/test_argcomplete.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/testing/test_argcomplete.py b/testing/test_argcomplete.py index 060cc2b49..046d69aa0 100644 --- a/testing/test_argcomplete.py +++ b/testing/test_argcomplete.py @@ -15,7 +15,7 @@ def equal_with_bash(prefix, ffc, fc, out=None): res_bash = set(fc(prefix)) retval = set(res) == res_bash if out: - out.write("equal_with_bash {} {}\n".format(retval, res)) + out.write("equal_with_bash({}) {} {}\n".format(prefix, retval, res)) if not retval: out.write(" python - bash: %s\n" % (set(res) - res_bash)) out.write(" bash - python: %s\n" % (res_bash - set(res))) @@ -91,13 +91,19 @@ class FilesCompleter(object): class TestArgComplete(object): @pytest.mark.skipif("sys.platform in ('win32', 'darwin')") - def test_compare_with_compgen(self): + def test_compare_with_compgen(self, tmpdir): from _pytest._argcomplete import FastFilesCompleter ffc = FastFilesCompleter() fc = FilesCompleter() - for x in ["/", "/d", "/data", "qqq", ""]: - assert equal_with_bash(x, ffc, fc, out=sys.stdout) + + with tmpdir.as_cwd(): + assert equal_with_bash("", ffc, fc, out=sys.stdout) + + tmpdir.ensure("data") + + for x in ["d", "data", "doesnotexist", ""]: + assert equal_with_bash(x, ffc, fc, out=sys.stdout) @pytest.mark.skipif("sys.platform in ('win32', 'darwin')") def test_remove_dir_prefix(self): From 825085f699f79030475f1632dc4a549b7ad4d45b Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 10 Nov 2018 23:53:47 +0100 Subject: [PATCH 03/11] Travis: use coverage from existing tox env [skip appveyor] --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 00abca0b2..aa56d0e39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,8 @@ after_success: - | if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then set -e - pip install coverage + # Add first TOXENV to $PATH. + PATH="$PWD/.tox/${TOXENV%%,*}/bin:$PATH" coverage combine coverage xml --ignore-errors coverage report -m --ignore-errors From dc9ceda5d2482b3d435b57afaef3e3f4a9a6137a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 10 Nov 2018 23:28:01 +0100 Subject: [PATCH 04/11] Travis: use Xenial by default [skip appveyor] --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 00abca0b2..7f05bc558 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ sudo: false language: python +dist: xenial stages: - baseline - name: test @@ -27,14 +28,13 @@ jobs: # Coverage tracking is slow with pypy, skip it. - env: TOXENV=pypy PYTEST_NO_COVERAGE=1 python: 'pypy-5.4' + dist: trusty - env: TOXENV=py35 python: '3.5' - env: TOXENV=py36-freeze PYTEST_NO_COVERAGE=1 python: '3.6' - env: TOXENV=py37 python: '3.7' - sudo: required - dist: xenial - &test-macos language: generic os: osx @@ -54,6 +54,7 @@ jobs: - stage: baseline env: TOXENV=py27 - env: TOXENV=py34 + python: '3.4' - env: TOXENV=py36 - env: TOXENV=linting,docs,doctesting PYTEST_NO_COVERAGE=1 From be15ad8d2521c8b5f48c6bf36c0e4e8031ef1f1d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 8 Nov 2018 01:24:38 +0100 Subject: [PATCH 05/11] Fix collection of direct symlinked files not in python_files Fixes https://github.com/pytest-dev/pytest/issues/4325. --- changelog/4321.bugfix.rst | 1 + changelog/4325.bugfix.rst | 1 + src/_pytest/main.py | 4 +-- testing/test_collection.py | 54 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 changelog/4321.bugfix.rst create mode 100644 changelog/4325.bugfix.rst diff --git a/changelog/4321.bugfix.rst b/changelog/4321.bugfix.rst new file mode 100644 index 000000000..8bfa9efde --- /dev/null +++ b/changelog/4321.bugfix.rst @@ -0,0 +1 @@ +Fix ``item.nodeid`` with resolved symlinks. diff --git a/changelog/4325.bugfix.rst b/changelog/4325.bugfix.rst new file mode 100644 index 000000000..71f13f429 --- /dev/null +++ b/changelog/4325.bugfix.rst @@ -0,0 +1 @@ +Fix collection of direct symlinked files, where the target does not match ``python_files``. diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 910812419..6e0eea0f0 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -488,7 +488,7 @@ class Session(nodes.FSCollector): from _pytest.python import Package names = self._parsearg(arg) - argpath = names.pop(0).realpath() + argpath = names.pop(0) # Start with a Session root, and delve to argpath item (dir or file) # and stack all Packages found on the way. @@ -636,7 +636,7 @@ class Session(nodes.FSCollector): "file or package not found: " + arg + " (missing __init__.py?)" ) raise UsageError("file not found: " + arg) - parts[0] = path + parts[0] = path.realpath() return parts def matchnodes(self, matching, names): diff --git a/testing/test_collection.py b/testing/test_collection.py index 18033b9c0..62bc0caf8 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -6,6 +6,8 @@ import pprint import sys import textwrap +import py + import pytest from _pytest.main import _in_venv from _pytest.main import EXIT_NOTESTSCOLLECTED @@ -1051,3 +1053,55 @@ def test_collect_handles_raising_on_dunder_class(testdir): result = testdir.runpytest() assert result.ret == 0 result.stdout.fnmatch_lines(["*1 passed in*"]) + + +@pytest.mark.skipif( + not hasattr(py.path.local, "mksymlinkto"), + reason="symlink not available on this platform", +) +def test_collect_symlink_file_arg(testdir): + """Test that collecting a direct symlink, where the target does not match python_files works (#4325).""" + real = testdir.makepyfile( + real=""" + def test_nodeid(request): + assert request.node.nodeid == "real.py::test_nodeid" + """ + ) + symlink = testdir.tmpdir.join("symlink.py") + symlink.mksymlinkto(real) + result = testdir.runpytest("-v", symlink) + result.stdout.fnmatch_lines(["real.py::test_nodeid PASSED*", "*1 passed in*"]) + assert result.ret == 0 + + +@pytest.mark.skipif( + not hasattr(py.path.local, "mksymlinkto"), + reason="symlink not available on this platform", +) +def test_collect_symlink_out_of_tree(testdir): + """Test collection of symlink via out-of-tree rootdir.""" + sub = testdir.tmpdir.join("sub") + real = sub.join("test_real.py") + real.write( + textwrap.dedent( + """ + def test_nodeid(request): + # Should not contain sub/ prefix. + assert request.node.nodeid == "test_real.py::test_nodeid" + """ + ), + ensure=True, + ) + + out_of_tree = testdir.tmpdir.join("out_of_tree").ensure(dir=True) + symlink_to_sub = out_of_tree.join("symlink_to_sub") + symlink_to_sub.mksymlinkto(sub) + sub.chdir() + result = testdir.runpytest("-vs", "--rootdir=%s" % sub, symlink_to_sub) + result.stdout.fnmatch_lines( + [ + # Should not contain "sub/"! + "test_real.py::test_nodeid PASSED" + ] + ) + assert result.ret == 0 From a6ff5e6bfc117f9151c6506a5f6f4bba51a1676c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 7 Nov 2018 21:32:51 +0100 Subject: [PATCH 06/11] Cleanup/follow-up to #4319 --- src/_pytest/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 910812419..9f4340b5a 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -386,6 +386,7 @@ class Session(nodes.FSCollector): self._initialpaths = frozenset() # Keep track of any collected nodes in here, so we don't duplicate fixtures self._node_cache = {} + # Dirnames of pkgs with dunder-init files. self._pkg_roots = {} self.config.pluginmanager.register(self, name="session") @@ -535,8 +536,7 @@ class Session(nodes.FSCollector): seen_dirs.add(dirpath) pkginit = dirpath.join("__init__.py") if pkginit.exists(): - collect_root = self._pkg_roots.get(dirpath, self) - for x in collect_root._collectfile(pkginit): + for x in self._collectfile(pkginit): yield x if isinstance(x, Package): self._pkg_roots[dirpath] = x From 2626bd9afa714c9ae1f50b99f7d0d18e7cf29d27 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 11 Nov 2018 13:43:04 +0000 Subject: [PATCH 07/11] Preparing release version 3.10.1 --- CHANGELOG.rst | 34 ++++++++++++++++++++++++++++++ changelog/4287.bugfix.rst | 1 - changelog/4304.bugfix.rst | 1 - changelog/4305.trivial.rst | 1 - changelog/4306.bugfix.rst | 1 - changelog/4310.bugfix.rst | 1 - changelog/4321.bugfix.rst | 1 - changelog/4325.bugfix.rst | 1 - changelog/4329.bugfix.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-3.10.1.rst | 24 +++++++++++++++++++++ doc/en/example/nonpython.rst | 7 +++--- 12 files changed, 62 insertions(+), 12 deletions(-) delete mode 100644 changelog/4287.bugfix.rst delete mode 100644 changelog/4304.bugfix.rst delete mode 100644 changelog/4305.trivial.rst delete mode 100644 changelog/4306.bugfix.rst delete mode 100644 changelog/4310.bugfix.rst delete mode 100644 changelog/4321.bugfix.rst delete mode 100644 changelog/4325.bugfix.rst delete mode 100644 changelog/4329.bugfix.rst create mode 100644 doc/en/announce/release-3.10.1.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 64a955198..c537d6b79 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,40 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 3.10.1 (2018-11-11) +========================== + +Bug Fixes +--------- + +- `#4287 `_: Fix nested usage of debugging plugin (pdb), e.g. with pytester's ``testdir.runpytest``. + + +- `#4304 `_: Block the ``stepwise`` plugin if ``cacheprovider`` is also blocked, as one depends on the other. + + +- `#4306 `_: Parse ``minversion`` as an actual version and not as dot-separated strings. + + +- `#4310 `_: Fix duplicate collection due to multiple args matching the same packages. + + +- `#4321 `_: Fix ``item.nodeid`` with resolved symlinks. + + +- `#4325 `_: Fix collection of direct symlinked files, where the target does not match ``python_files``. + + +- `#4329 `_: Fix TypeError in report_collect with _collect_report_last_write. + + + +Trivial/Internal Changes +------------------------ + +- `#4305 `_: Replace byte/unicode helpers in test_capture with python level syntax. + + pytest 3.10.0 (2018-11-03) ========================== diff --git a/changelog/4287.bugfix.rst b/changelog/4287.bugfix.rst deleted file mode 100644 index 5ba5fbb7a..000000000 --- a/changelog/4287.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix nested usage of debugging plugin (pdb), e.g. with pytester's ``testdir.runpytest``. diff --git a/changelog/4304.bugfix.rst b/changelog/4304.bugfix.rst deleted file mode 100644 index 7d4dc033e..000000000 --- a/changelog/4304.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Block the ``stepwise`` plugin if ``cacheprovider`` is also blocked, as one depends on the other. diff --git a/changelog/4305.trivial.rst b/changelog/4305.trivial.rst deleted file mode 100644 index 2430a5f91..000000000 --- a/changelog/4305.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Replace byte/unicode helpers in test_capture with python level syntax. diff --git a/changelog/4306.bugfix.rst b/changelog/4306.bugfix.rst deleted file mode 100644 index cb2872d3f..000000000 --- a/changelog/4306.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Parse ``minversion`` as an actual version and not as dot-separated strings. diff --git a/changelog/4310.bugfix.rst b/changelog/4310.bugfix.rst deleted file mode 100644 index 24e177c2e..000000000 --- a/changelog/4310.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix duplicate collection due to multiple args matching the same packages. diff --git a/changelog/4321.bugfix.rst b/changelog/4321.bugfix.rst deleted file mode 100644 index 8bfa9efde..000000000 --- a/changelog/4321.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ``item.nodeid`` with resolved symlinks. diff --git a/changelog/4325.bugfix.rst b/changelog/4325.bugfix.rst deleted file mode 100644 index 71f13f429..000000000 --- a/changelog/4325.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix collection of direct symlinked files, where the target does not match ``python_files``. diff --git a/changelog/4329.bugfix.rst b/changelog/4329.bugfix.rst deleted file mode 100644 index 6acfe7e61..000000000 --- a/changelog/4329.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix TypeError in report_collect with _collect_report_last_write. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 8f583c5f5..e0df8eb1d 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-3.10.1 release-3.10.0 release-3.9.3 release-3.9.2 diff --git a/doc/en/announce/release-3.10.1.rst b/doc/en/announce/release-3.10.1.rst new file mode 100644 index 000000000..556b24ae1 --- /dev/null +++ b/doc/en/announce/release-3.10.1.rst @@ -0,0 +1,24 @@ +pytest-3.10.1 +======================================= + +pytest 3.10.1 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Anthony Sottile +* Boris Feld +* Bruno Oliveira +* Daniel Hahler +* Fabien ZARIFIAN +* Jon Dufresne +* Ronny Pfannschmidt + + +Happy testing, +The pytest Development Team diff --git a/doc/en/example/nonpython.rst b/doc/en/example/nonpython.rst index 8bcb75b43..bda15065a 100644 --- a/doc/en/example/nonpython.rst +++ b/doc/en/example/nonpython.rst @@ -85,9 +85,8 @@ interesting to just look at the collection tree:: rootdir: $REGENDOC_TMPDIR/nonpython, inifile: collected 2 items - - - - + + + ======================= no tests ran in 0.12 seconds ======================= From 96282424233029ce912e33efb36db0fc8ef91bf1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 11 Nov 2018 21:49:24 +0100 Subject: [PATCH 08/11] CI: doctesting uses coverage, fiy py37 on AppVeyor --- .travis.yml | 2 +- appveyor.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e3256a7d..37fc9ddec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,7 +56,7 @@ jobs: - env: TOXENV=py34 python: '3.4' - env: TOXENV=py36 - - env: TOXENV=linting,docs,doctesting PYTEST_NO_COVERAGE=1 + - env: TOXENV=linting,docs,doctesting - stage: deploy python: '3.6' diff --git a/appveyor.yml b/appveyor.yml index abe431984..1e287c3c2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,6 @@ environment: matrix: - TOXENV: "py27" - TOXENV: "py37" - PYTEST_NO_COVERAGE: "1" - TOXENV: "linting,docs,doctesting" - TOXENV: "py36" - TOXENV: "py35" From 74366426b9ea4ee15f2781a5e3d85b47a024e746 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 11 Nov 2018 22:08:45 +0100 Subject: [PATCH 09/11] Travis: use last TOXENV for PATH --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37fc9ddec..e5e270bf2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -89,8 +89,8 @@ after_success: - | if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then set -e - # Add first TOXENV to $PATH. - PATH="$PWD/.tox/${TOXENV%%,*}/bin:$PATH" + # Add last TOXENV to $PATH. + PATH="$PWD/.tox/${TOXENV##*,}/bin:$PATH" coverage combine coverage xml --ignore-errors coverage report -m --ignore-errors From 935b106213bc14fa45e080051f209c8c5372dd34 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 11 Nov 2018 21:45:34 +0100 Subject: [PATCH 10/11] CI: use py37 instead of py36 by default Closes https://github.com/pytest-dev/pytest/issues/4370. --- .travis.yml | 16 ++++++++-------- CONTRIBUTING.rst | 12 ++++++------ appveyor.yml | 10 +++++----- tox.ini | 18 +++++++++--------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e3256a7d..a96084592 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ stages: - name: deploy if: repo = pytest-dev/pytest AND tag IS present python: - - '3.6' + - '3.7' install: - pip install --upgrade --pre tox env: @@ -18,10 +18,11 @@ env: - TOXENV=py27-nobyte - TOXENV=py27-xdist - TOXENV=py27-pluggymaster PYTEST_NO_COVERAGE=1 - # Specialized factors for py36. - - TOXENV=py36-pexpect,py36-trial,py36-numpy - - TOXENV=py36-xdist - - TOXENV=py36-pluggymaster PYTEST_NO_COVERAGE=1 + # Specialized factors for py37. + - TOXENV=py37-pexpect,py37-trial,py37-numpy + - TOXENV=py37-xdist + - TOXENV=py37-pluggymaster PYTEST_NO_COVERAGE=1 + - TOXENV=py37-freeze PYTEST_NO_COVERAGE=1 jobs: include: @@ -31,10 +32,7 @@ jobs: dist: trusty - env: TOXENV=py35 python: '3.5' - - env: TOXENV=py36-freeze PYTEST_NO_COVERAGE=1 - python: '3.6' - env: TOXENV=py37 - python: '3.7' - &test-macos language: generic os: osx @@ -56,7 +54,9 @@ jobs: - env: TOXENV=py34 python: '3.4' - env: TOXENV=py36 + python: '3.6' - env: TOXENV=linting,docs,doctesting PYTEST_NO_COVERAGE=1 + python: '3.7' - stage: deploy python: '3.6' diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index d3202f7c8..ea778149c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -169,7 +169,7 @@ Short version #. Follow **PEP-8** for naming and `black `_ for formatting. #. Tests are run using ``tox``:: - tox -e linting,py27,py36 + tox -e linting,py27,py37 The test environments above are usually enough to cover most cases locally. @@ -237,12 +237,12 @@ Here is a simple overview, with pytest-specific bits: #. Run all the tests - You need to have Python 2.7 and 3.6 available in your system. Now + You need to have Python 2.7 and 3.7 available in your system. Now running tests is as simple as issuing this command:: - $ tox -e linting,py27,py36 + $ tox -e linting,py27,py37 - This command will run tests via the "tox" tool against Python 2.7 and 3.6 + This command will run tests via the "tox" tool against Python 2.7 and 3.7 and also perform "lint" coding-style checks. #. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming. @@ -252,9 +252,9 @@ Here is a simple overview, with pytest-specific bits: $ tox -e py27 -- --pdb - Or to only run tests in a particular test module on Python 3.6:: + Or to only run tests in a particular test module on Python 3.7:: - $ tox -e py36 -- testing/test_config.py + $ tox -e py37 -- testing/test_config.py When committing, ``pre-commit`` will re-format the files if necessary. diff --git a/appveyor.yml b/appveyor.yml index abe431984..313ff6131 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,13 +14,13 @@ environment: - TOXENV: "py27-pluggymaster" PYTEST_NO_COVERAGE: "1" - TOXENV: "py27-xdist" - # Specialized factors for py36. - - TOXENV: "py36-trial,py36-numpy" - - TOXENV: "py36-pluggymaster" + # Specialized factors for py37. + - TOXENV: "py37-trial,py37-numpy" + - TOXENV: "py37-pluggymaster" PYTEST_NO_COVERAGE: "1" - - TOXENV: "py36-freeze" + - TOXENV: "py37-freeze" PYTEST_NO_COVERAGE: "1" - - TOXENV: "py36-xdist" + - TOXENV: "py37-xdist" matrix: fast_finish: true diff --git a/tox.ini b/tox.ini index dbfd4eef5..e3ace72d3 100644 --- a/tox.ini +++ b/tox.ini @@ -10,10 +10,10 @@ envlist = py36 py37 pypy - {py27,py36}-{pexpect,xdist,trial,numpy,pluggymaster} + {py27,py37}-{pexpect,xdist,trial,numpy,pluggymaster} py27-nobyte doctesting - py36-freeze + py37-freeze docs [testenv] @@ -23,7 +23,7 @@ commands = coverage: coverage report passenv = USER USERNAME COVERAGE_* TRAVIS setenv = - # configuration if a user runs tox with a "coverage" factor, for example "tox -e py36-coverage" + # configuration if a user runs tox with a "coverage" factor, for example "tox -e py37-coverage" coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess coverage: COVERAGE_FILE={toxinidir}/.coverage @@ -60,7 +60,7 @@ deps = commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto {posargs} -[testenv:py36-xdist] +[testenv:py37-xdist] # NOTE: copied from above due to https://github.com/tox-dev/tox/issues/706. deps = pytest-xdist>=1.13 @@ -78,7 +78,7 @@ deps = commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest testing/test_pdb.py testing/test_terminal.py testing/test_unittest.py {posargs} -[testenv:py36-pexpect] +[testenv:py37-pexpect] platform = {[testenv:py27-pexpect]platform} deps = {[testenv:py27-pexpect]deps} commands = {[testenv:py27-pexpect]commands} @@ -103,7 +103,7 @@ deps = commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:testing/test_unittest.py} -[testenv:py36-trial] +[testenv:py37-trial] deps = {[testenv:py27-trial]deps} commands = {[testenv:py27-trial]commands} @@ -114,7 +114,7 @@ deps = commands= {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:testing/python/approx.py} -[testenv:py36-numpy] +[testenv:py37-numpy] deps = {[testenv:py27-numpy]deps} commands = {[testenv:py27-numpy]commands} @@ -125,7 +125,7 @@ setenv= # NOTE: using env instead of "{[testenv]deps}", because of https://github.com/tox-dev/tox/issues/706. _PYTEST_TOX_EXTRA_DEP=git+https://github.com/pytest-dev/pluggy.git@master -[testenv:py36-pluggymaster] +[testenv:py37-pluggymaster] setenv = {[testenv:py27-pluggymaster]setenv} [testenv:docs] @@ -170,7 +170,7 @@ changedir = testing commands = {envpython} {envbindir}/py.test-jython {posargs} -[testenv:py36-freeze] +[testenv:py37-freeze] changedir = testing/freeze deps = pyinstaller From 0df5ce408260d1d5f686a8690022a4b0e421e11a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 12 Nov 2018 14:03:04 -0200 Subject: [PATCH 11/11] Fix basepython for linting testenv in tox.ini --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e3ace72d3..bc13826e2 100644 --- a/tox.ini +++ b/tox.ini @@ -46,7 +46,7 @@ commands = [testenv:linting] skip_install = True -basepython = python3.6 +basepython = python3 deps = pre-commit>=1.11.0 commands = pre-commit run --all-files --show-diff-on-failure