Skip to content

Merge master into features (about to prepare 4.0) #4383

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

Merged
merged 22 commits into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bee72a6
Fix nodes._check_initialpaths_for_relpath for dirs
blueyed Nov 8, 2018
e14ca19
Merge pull request #4352 from blueyed/_check_initialpaths_for_relpath
blueyed Nov 10, 2018
b51c1c3
tests: fix equal_with_bash for .coverage files
blueyed Nov 9, 2018
7ab3d81
Merge pull request #4356 from blueyed/fix-equal_with_bash
blueyed Nov 10, 2018
825085f
Travis: use coverage from existing tox env [skip appveyor]
blueyed Nov 10, 2018
dc9ceda
Travis: use Xenial by default [skip appveyor]
blueyed Nov 10, 2018
be15ad8
Fix collection of direct symlinked files not in python_files
blueyed Nov 8, 2018
a6ff5e6
Cleanup/follow-up to #4319
blueyed Nov 7, 2018
e5a9f92
Merge pull request #4337 from blueyed/fix-sym
nicoddemus Nov 11, 2018
b6f16ab
Merge pull request #4369 from blueyed/cleanup
nicoddemus Nov 11, 2018
2626bd9
Preparing release version 3.10.1
nicoddemus Nov 11, 2018
11a9cbd
Merge pull request #4365 from blueyed/xenial
nicoddemus Nov 11, 2018
7b833ce
Merge pull request #4368 from blueyed/toxenv-coverage
nicoddemus Nov 11, 2018
9af613b
Merge pull request #4372 from nicoddemus/release-3.10.1
nicoddemus Nov 11, 2018
9628242
CI: doctesting uses coverage, fiy py37 on AppVeyor
blueyed Nov 11, 2018
7436642
Travis: use last TOXENV for PATH
blueyed Nov 11, 2018
935b106
CI: use py37 instead of py36 by default
blueyed Nov 11, 2018
93a9836
Merge pull request #4374 from blueyed/doctesting
nicoddemus Nov 12, 2018
0df5ce4
Fix basepython for linting testenv in tox.ini
nicoddemus Nov 12, 2018
3cec148
Merge branch 'master' into py37-by-default
nicoddemus Nov 12, 2018
243d898
Merge pull request #4373 from blueyed/py37-by-default
nicoddemus Nov 12, 2018
557cb6c
Merge remote-tracking branch 'upstream/master' into merge-master-into…
nicoddemus Nov 13, 2018
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
26 changes: 14 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
sudo: false
language: python
dist: xenial
stages:
- baseline
- name: test
if: repo = pytest-dev/pytest AND tag IS NOT present
- name: deploy
if: repo = pytest-dev/pytest AND tag IS present
python:
- '3.6'
- '3.7'
install:
- pip install --upgrade --pre tox
env:
Expand All @@ -17,24 +18,21 @@ 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:
# 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
Expand All @@ -54,8 +52,11 @@ jobs:
- stage: baseline
env: TOXENV=py27
- env: TOXENV=py34
python: '3.4'
- env: TOXENV=py36
- env: TOXENV=linting,docs,doctesting PYTEST_NO_COVERAGE=1
python: '3.6'
- env: TOXENV=linting,docs,doctesting
python: '3.7'

- stage: deploy
python: '3.6'
Expand Down Expand Up @@ -88,7 +89,8 @@ after_success:
- |
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
set -e
pip install coverage
# Add last TOXENV to $PATH.
PATH="$PWD/.tox/${TOXENV##*,}/bin:$PATH"
coverage combine
coverage xml --ignore-errors
coverage report -m --ignore-errors
Expand Down
34 changes: 34 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/pytest-dev/pytest/issues/4287>`_: Fix nested usage of debugging plugin (pdb), e.g. with pytester's ``testdir.runpytest``.


- `#4304 <https://github.com/pytest-dev/pytest/issues/4304>`_: Block the ``stepwise`` plugin if ``cacheprovider`` is also blocked, as one depends on the other.


- `#4306 <https://github.com/pytest-dev/pytest/issues/4306>`_: Parse ``minversion`` as an actual version and not as dot-separated strings.


- `#4310 <https://github.com/pytest-dev/pytest/issues/4310>`_: Fix duplicate collection due to multiple args matching the same packages.


- `#4321 <https://github.com/pytest-dev/pytest/issues/4321>`_: Fix ``item.nodeid`` with resolved symlinks.


- `#4325 <https://github.com/pytest-dev/pytest/issues/4325>`_: Fix collection of direct symlinked files, where the target does not match ``python_files``.


- `#4329 <https://github.com/pytest-dev/pytest/issues/4329>`_: Fix TypeError in report_collect with _collect_report_last_write.



Trivial/Internal Changes
------------------------

- `#4305 <https://github.com/pytest-dev/pytest/issues/4305>`_: Replace byte/unicode helpers in test_capture with python level syntax.


pytest 3.10.0 (2018-11-03)
==========================

Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Short version
#. Follow **PEP-8** for naming and `black <https://github.com/ambv/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.

Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
11 changes: 5 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ environment:
matrix:
- TOXENV: "py27"
- TOXENV: "py37"
PYTEST_NO_COVERAGE: "1"
- TOXENV: "linting,docs,doctesting"
- TOXENV: "py36"
- TOXENV: "py35"
Expand All @@ -14,13 +13,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
Expand Down
1 change: 0 additions & 1 deletion changelog/4287.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4304.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4305.trivial.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4306.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4310.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog/4329.bugfix.rst

This file was deleted.

1 change: 1 addition & 0 deletions doc/en/announce/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release announcements
:maxdepth: 2


release-3.10.1
release-3.10.0
release-3.9.3
release-3.9.2
Expand Down
24 changes: 24 additions & 0 deletions doc/en/announce/release-3.10.1.rst
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions doc/en/example/nonpython.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ interesting to just look at the collection tree::
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
collected 2 items
<Package '$REGENDOC_TMPDIR/nonpython'>
<Package '$REGENDOC_TMPDIR/nonpython'>
<YamlFile 'test_simple.yml'>
<YamlItem 'hello'>
<YamlItem 'ok'>
<YamlFile 'test_simple.yml'>
<YamlItem 'hello'>
<YamlItem 'ok'>

======================= no tests ran in 0.12 seconds =======================
8 changes: 4 additions & 4 deletions src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def __init__(self, config):
# Keep track of any collected nodes in here, so we don't duplicate fixtures
self._node_cache = {}
self._bestrelpathcache = _bestrelpath_cache(config.rootdir)
# Dirnames of pkgs with dunder-init files.
self._pkg_roots = {}

self.config.pluginmanager.register(self, name="session")
Expand Down Expand Up @@ -504,7 +505,7 @@ def _collect(self, arg):
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.
Expand Down Expand Up @@ -551,8 +552,7 @@ def filter_(f):
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
Expand Down Expand Up @@ -652,7 +652,7 @@ def _parsearg(self, arg):
"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):
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def _prunetraceback(self, excinfo):
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):
Expand Down
10 changes: 5 additions & 5 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,11 @@ def test_cmdline_python_namespace_package(self, testdir, monkeypatch):
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*",
]
)

Expand Down
14 changes: 10 additions & 4 deletions testing/test_argcomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -91,13 +91,19 @@ def __call__(self, prefix, **kwargs):

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):
Expand Down
53 changes: 53 additions & 0 deletions testing/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import sys
import textwrap

import py

import pytest
from _pytest.main import _in_venv
from _pytest.main import EXIT_NOTESTSCOLLECTED
Expand Down Expand Up @@ -1082,4 +1084,55 @@ def test_1():
with testdir.tmpdir.as_cwd():
result = testdir.runpytest("--collect-only")
result.stdout.fnmatch_lines(["collected 1 item"])


@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
Loading