[Python-modules-commits] [pytest] 02/07: Import pytest_3.0.1.orig.tar.gz
Sebastian Ramacher
sramacher at moszumanska.debian.org
Wed Aug 24 17:30:10 UTC 2016
This is an automated email from the git hooks/post-receive script.
sramacher pushed a commit to branch master
in repository pytest.
commit bc9cf593ab13c00bc281876945cd74df8f4b7cad
Author: Sebastian Ramacher <sramacher at debian.org>
Date: Wed Aug 24 19:25:59 2016 +0200
Import pytest_3.0.1.orig.tar.gz
---
AUTHORS | 3 +-
CHANGELOG.rst | 44 ++++++---
HOWTORELEASE.rst | 85 +++++++++++++++++
MANIFEST.in | 4 +-
PKG-INFO | 2 +-
_pytest/__init__.py | 2 +-
_pytest/main.py | 2 +-
_pytest/mark.py | 15 +++
_pytest/python.py | 75 +++++++++------
_pytest/runner.py | 17 +++-
doc/en/announce/index.rst | 2 +
doc/en/announce/release-2.6.3.rst | 2 +-
doc/en/announce/release-3.0.0.rst | 4 +-
doc/en/announce/release-3.0.1.rst | 26 +++++
doc/en/assert.rst | 4 +-
doc/en/cache.rst | 6 +-
doc/en/capture.rst | 2 +-
doc/en/customize.rst | 10 ++
doc/en/doctest.rst | 2 +-
doc/en/example/layout1/setup.cfg | 4 -
doc/en/example/markers.rst | 28 +++---
doc/en/example/nonpython.rst | 6 +-
doc/en/example/parametrize.rst | 12 +--
doc/en/example/pythoncollection.rst | 6 +-
doc/en/example/reportingdemo.rst | 4 +-
doc/en/example/simple.rst | 22 ++---
doc/en/fixture.rst | 10 +-
doc/en/getting-started.rst | 4 +-
doc/en/parametrize.rst | 4 +-
doc/en/skipping.rst | 2 +-
doc/en/tmpdir.rst | 2 +-
doc/en/unittest.rst | 2 +-
doc/en/writing_plugins.rst | 2 +-
pytest.egg-info/PKG-INFO | 2 +-
pytest.egg-info/SOURCES.txt | 3 +-
setup.cfg | 2 +-
testing/acceptance_test.py | 18 ++++
testing/python/metafunc.py | 183 ++++++++++++++++++++++++++++--------
testing/test_runner.py | 13 +++
testing/test_skipping.py | 2 +-
tox.ini | 2 +-
41 files changed, 476 insertions(+), 164 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 4bff819..2e487e7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -48,7 +48,6 @@ Eduardo Schettino
Elizaveta Shashkova
Endre Galaczi
Eric Hunsberger
-Eric Hunsberger
Eric Siegerman
Erik M. Bray
Feng Ma
@@ -81,6 +80,7 @@ Lukas Bednar
Maciek Fijalkowski
Maho
Marc Schlaich
+Marcin Bachry
Mark Abramowitz
Markus Unterwaditzer
Martijn Faassen
@@ -88,6 +88,7 @@ Martin K. Scherer
Martin Prusse
Matt Bachmann
Matt Williams
+Matthias Hafner
Michael Aquilina
Michael Birtwell
Michael Droettboom
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 69971a7..0342b75 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,29 @@
+3.0.1
+=====
+
+* Fix regression when ``importorskip`` is used at module level (`#1822`_).
+ Thanks `@jaraco`_ and `@The-Compiler`_ for the report and `@nicoddemus`_ for the PR.
+
+* Fix parametrization scope when session fixtures are used in conjunction
+ with normal parameters in the same call (`#1832`_).
+ Thanks `@The-Compiler`_ for the report, `@Kingdread`_ and `@nicoddemus`_ for the PR.
+
+* Fix internal error when parametrizing tests or fixtures using an empty ``ids`` argument (`#1849`_).
+ Thanks `@OPpuolitaival`_ for the report and `@nicoddemus`_ for the PR.
+
+* Fix loader error when running ``pytest`` embedded in a zipfile.
+ Thanks `@mbachry`_ for the PR.
+
+
+.. _ at Kingdread: https://github.com/Kingdread
+.. _ at mbachry: https://github.com/mbachry
+.. _ at OPpuolitaival: https://github.com/OPpuolitaival
+
+.. _#1822: https://github.com/pytest-dev/pytest/issues/1822
+.. _#1832: https://github.com/pytest-dev/pytest/issues/1832
+.. _#1849: https://github.com/pytest-dev/pytest/issues/1849
+
+
3.0.0
=====
@@ -234,12 +260,6 @@ time or change existing behaviors in order to make them less surprising/more use
removed in pytest-4.0 (`#1684`_).
Thanks `@nicoddemus`_ for the PR.
-* Raise helpful failure message, when requesting parametrized fixture at runtime,
- e.g. with ``request.getfuncargvalue``. BACKWARD INCOMPAT: Previously these params
- were simply never defined. So a fixture decorated like ``@pytest.fixture(params=[0, 1, 2])``
- only ran once. Now a failure is raised. Fixes (`#460`_). Thanks to
- `@nikratio`_ for bug report, `@RedBeardCode`_ and `@tomviner`_ for the PR.
-
* Passing a command-line string to ``pytest.main()`` is considered deprecated and scheduled
for removal in pytest-4.0. It is recommended to pass a list of arguments instead (`#1723`_).
@@ -254,15 +274,14 @@ time or change existing behaviors in order to make them less surprising/more use
* Refined logic for determining the ``rootdir``, considering only valid
paths which fixes a number of issues: `#1594`_, `#1435`_ and `#1471`_.
- Thanks to `@blueyed`_ and `@davehunt`_ for the PR.
+ Updated the documentation according to current behavior. Thanks to
+ `@blueyed`_, `@davehunt`_ and `@matthiasha`_ for the PR.
* Always include full assertion explanation. The previous behaviour was hiding
sub-expressions that happened to be False, assuming this was redundant information.
Thanks `@bagerard`_ for reporting (`#1503`_). Thanks to `@davehunt`_ and
`@tomviner`_ for PR.
-* Renamed the pytest ``pdb`` module (plugin) into ``debugging``.
-
* Better message in case of not using parametrized variable (see `#1539`_).
Thanks to `@tramwaj29`_ for the PR.
@@ -307,10 +326,6 @@ time or change existing behaviors in order to make them less surprising/more use
identify bugs in ``conftest.py`` files (`#1516`_). Thanks `@txomon`_ for
the PR.
-* Add an 'E' to the first line of error messages from FixtureLookupErrorRepr.
- Fixes `#717`_. Thanks `@blueyed`_ for reporting, `@eolo999`_ for the PR
- and `@tomviner`_ for his guidance during EuroPython2016 sprint.
-
* Text documents without any doctests no longer appear as "skipped".
Thanks `@graingert`_ for reporting and providing a full PR (`#1580`_).
@@ -428,6 +443,7 @@ time or change existing behaviors in order to make them less surprising/more use
.. _ at tramwaj29: https://github.com/tramwaj29
.. _ at txomon: https://github.com/txomon
.. _ at Vogtinator: https://github.com/Vogtinator
+.. _ at matthiasha: https://github.com/matthiasha
2.9.2
@@ -1208,7 +1224,7 @@ time or change existing behaviors in order to make them less surprising/more use
dep). Thanks Charles Cloud for analysing the issue.
- fix conftest related fixture visibility issue: when running with a
- CWD outside a test package pytest would get fixture discovery wrong.
+ CWD outside of a test package pytest would get fixture discovery wrong.
Thanks to Wolfgang Schnerring for figuring out a reproducable example.
- Introduce pytest_enter_pdb hook (needed e.g. by pytest_timeout to cancel the
diff --git a/HOWTORELEASE.rst b/HOWTORELEASE.rst
new file mode 100644
index 0000000..e6f1973
--- /dev/null
+++ b/HOWTORELEASE.rst
@@ -0,0 +1,85 @@
+How to release pytest
+--------------------------------------------
+
+Note: this assumes you have already registered on pypi.
+
+1. Bump version numbers in ``_pytest/__init__.py`` (``setup.py`` reads it).
+
+2. Check and finalize ``CHANGELOG.rst``.
+
+3. Write ``doc/en/announce/release-VERSION.txt`` and include
+ it in ``doc/en/announce/index.txt``. Run this command to list names of authors involved::
+
+ git log $(git describe --abbrev=0 --tags)..HEAD --format='%aN' | sort -u
+
+4. Regenerate the docs examples using tox::
+
+ tox -e regen
+
+5. At this point, open a PR named ``release-X`` so others can help find regressions or provide suggestions.
+
+6. Use devpi for uploading a release tarball to a staging area::
+
+ devpi use https://devpi.net/USER/dev
+ devpi upload --formats sdist,bdist_wheel
+
+7. Run from multiple machines::
+
+ devpi use https://devpi.net/USER/dev
+ devpi test pytest==VERSION
+
+ Alternatively, you can use `devpi-cloud-tester <https://github.com/nicoddemus/devpi-cloud-tester>`_ to test
+ the package on AppVeyor and Travis (follow instructions on the ``README``).
+
+8. Check that tests pass for relevant combinations with::
+
+ devpi list pytest
+
+ or look at failures with "devpi list -f pytest".
+
+9. Feeling confident? Publish to pypi::
+
+ devpi push pytest==VERSION pypi:NAME
+
+ where NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
+ file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_.
+
+10. Tag the release::
+
+ git tag VERSION <hash>
+ git push origin VERSION
+
+ Make sure ``<hash>`` is **exactly** the git hash at the time the package was created.
+
+11. Send release announcement to mailing lists:
+
+ - pytest-dev at python.org
+ - testing-in-python at lists.idyll.org
+ - python-announce-list at python.org
+
+ And announce the release on Twitter, making sure to add the hashtag ``#pytest``.
+
+12. **After the release**
+
+ a. **patch release (2.8.3)**:
+
+ 1. Checkout ``master``.
+ 2. Update version number in ``_pytest/__init__.py`` to ``"2.8.4.dev"``.
+ 3. Create a new section in ``CHANGELOG.rst`` titled ``2.8.4.dev`` and add a few bullet points as placeholders for new entries.
+ 4. Commit and push.
+
+ b. **minor release (2.9.0)**:
+
+ 1. Merge ``features`` into ``master``.
+ 2. Checkout ``master``.
+ 3. Follow the same steps for a **patch release** above, using the next patch release: ``2.9.1.dev``.
+ 4. Commit ``master``.
+ 5. Checkout ``features`` and merge with ``master`` (should be a fast-forward at this point).
+ 6. Update version number in ``_pytest/__init__.py`` to the next minor release: ``"2.10.0.dev"``.
+ 7. Create a new section in ``CHANGELOG.rst`` titled ``2.10.0.dev``, above ``2.9.1.dev``, and add a few bullet points as placeholders for new entries.
+ 8. Commit ``features``.
+ 9. Push ``master`` and ``features``.
+
+ c. **major release (3.0.0)**: same steps as that of a **minor release**
+
+
diff --git a/MANIFEST.in b/MANIFEST.in
index 266a918..079b225 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -4,6 +4,7 @@ include AUTHORS
include README.rst
include CONTRIBUTING.rst
+include HOWTORELEASE.rst
include tox.ini
include setup.py
@@ -29,6 +30,3 @@ recursive-exclude * *.pyc *.pyo
exclude appveyor/install.ps1
exclude appveyor.yml
exclude appveyor
-
-exclude ISSUES.txt
-exclude HOWTORELEASE.rst
diff --git a/PKG-INFO b/PKG-INFO
index 21192d1..50060de 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pytest
-Version: 3.0.0
+Version: 3.0.1
Summary: pytest: simple powerful testing with Python
Home-page: http://pytest.org
Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others
diff --git a/_pytest/__init__.py b/_pytest/__init__.py
index 40f6653..73704d9 100644
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,2 +1,2 @@
#
-__version__ = '3.0.0'
+__version__ = '3.0.1'
diff --git a/_pytest/main.py b/_pytest/main.py
index 48f5bb6..5771a16 100644
--- a/_pytest/main.py
+++ b/_pytest/main.py
@@ -687,7 +687,7 @@ class Session(FSCollector):
# This method is sometimes invoked when AssertionRewritingHook, which
# does not define a get_filename method, is already in place:
try:
- path = loader.get_filename()
+ path = loader.get_filename(x)
except AttributeError:
# Retrieve path from AssertionRewritingHook:
path = loader.modules[x][0].co_filename
diff --git a/_pytest/mark.py b/_pytest/mark.py
index d8b60de..40c998c 100644
--- a/_pytest/mark.py
+++ b/_pytest/mark.py
@@ -283,6 +283,21 @@ class MarkDecorator:
return self.__class__(self.name, args=args, kwargs=kw)
+def extract_argvalue(maybe_marked_args):
+ # TODO: incorrect mark data, the old code wanst able to collect lists
+ # individual parametrized argument sets can be wrapped in a series
+ # of markers in which case we unwrap the values and apply the mark
+ # at Function init
+ newmarks = {}
+ argval = maybe_marked_args
+ while isinstance(argval, MarkDecorator):
+ newmark = MarkDecorator(argval.markname,
+ argval.args[:-1], argval.kwargs)
+ newmarks[newmark.markname] = newmark
+ argval = argval.args[-1]
+ return argval, newmarks
+
+
class MarkInfo:
""" Marking object created by :class:`MarkDecorator` instances. """
def __init__(self, name, args, kwargs):
diff --git a/_pytest/python.py b/_pytest/python.py
index 9e9c788..75d139d 100644
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -5,10 +5,11 @@ import inspect
import sys
import collections
import math
+from itertools import count
import py
import pytest
-from _pytest.mark import MarkDecorator, MarkerError
+from _pytest.mark import MarkerError
import _pytest
@@ -431,10 +432,12 @@ class Module(pytest.File, PyCollector):
"Make sure your test modules/packages have valid Python names."
% (self.fspath, exc or exc_class)
)
- except _pytest.runner.Skipped:
+ except _pytest.runner.Skipped as e:
+ if e.allow_module_level:
+ raise
raise self.CollectError(
- "Using @pytest.skip outside a test (e.g. as a test function "
- "decorator) is not allowed. Use @pytest.mark.skip or "
+ "Using @pytest.skip outside of a test (e.g. as a test "
+ "function decorator) is not allowed. Use @pytest.mark.skip or "
"@pytest.mark.skipif instead."
)
self.config.pluginmanager.consider_module(mod)
@@ -774,19 +777,14 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
to set a dynamic scope using test context or configuration.
"""
from _pytest.fixtures import scopes
- # individual parametrized argument sets can be wrapped in a series
- # of markers in which case we unwrap the values and apply the mark
- # at Function init
- newkeywords = {}
+ from _pytest.mark import extract_argvalue
+
unwrapped_argvalues = []
- for i, argval in enumerate(argvalues):
- while isinstance(argval, MarkDecorator):
- newmark = MarkDecorator(argval.markname,
- argval.args[:-1], argval.kwargs)
- newmarks = newkeywords.setdefault(i, {})
- newmarks[newmark.markname] = newmark
- argval = argval.args[-1]
+ newkeywords = []
+ for maybe_marked_args in argvalues:
+ argval, newmarks = extract_argvalue(maybe_marked_args)
unwrapped_argvalues.append(argval)
+ newkeywords.append(newmarks)
argvalues = unwrapped_argvalues
if not isinstance(argnames, (tuple, list)):
@@ -801,18 +799,11 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
newmark = pytest.mark.skip(
reason="got empty parameter set %r, function %s at %s:%d" % (
argnames, self.function.__name__, fs, lineno))
- newmarks = newkeywords.setdefault(0, {})
- newmarks[newmark.markname] = newmark
+ newkeywords = [{newmark.markname: newmark}]
if scope is None:
- if self._arg2fixturedefs:
- # Takes the most narrow scope from used fixtures
- fixtures_scopes = [fixturedef[0].scope for fixturedef in self._arg2fixturedefs.values()]
- for scope in reversed(scopes):
- if scope in fixtures_scopes:
- break
- else:
- scope = 'function'
+ scope = _find_parametrized_scope(argnames, self._arg2fixturedefs, indirect)
+
scopenum = scopes.index(scope)
valtypes = {}
for arg in argnames:
@@ -846,12 +837,12 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
ids = idmaker(argnames, argvalues, idfn, ids, self.config)
newcalls = []
for callspec in self._calls or [CallSpec2(self)]:
- for param_index, valset in enumerate(argvalues):
+ elements = zip(ids, argvalues, newkeywords, count())
+ for a_id, valset, keywords, param_index in elements:
assert len(valset) == len(argnames)
newcallspec = callspec.copy(self)
- newcallspec.setmulti(valtypes, argnames, valset, ids[param_index],
- newkeywords.get(param_index, {}), scopenum,
- param_index)
+ newcallspec.setmulti(valtypes, argnames, valset, a_id,
+ keywords, scopenum, param_index)
newcalls.append(newcallspec)
self._calls = newcalls
@@ -892,6 +883,30 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
self._calls.append(cs)
+def _find_parametrized_scope(argnames, arg2fixturedefs, indirect):
+ """Find the most appropriate scope for a parametrized call based on its arguments.
+
+ When there's at least one direct argument, always use "function" scope.
+
+ When a test function is parametrized and all its arguments are indirect
+ (e.g. fixtures), return the most narrow scope based on the fixtures used.
+
+ Related to issue #1832, based on code posted by @Kingdread.
+ """
+ from _pytest.fixtures import scopes
+ indirect_as_list = isinstance(indirect, (list, tuple))
+ all_arguments_are_fixtures = indirect is True or \
+ indirect_as_list and len(indirect) == argnames
+ if all_arguments_are_fixtures:
+ fixturedefs = arg2fixturedefs or {}
+ used_scopes = [fixturedef[0].scope for name, fixturedef in fixturedefs.items()]
+ if used_scopes:
+ # Takes the most narrow scope from used fixtures
+ for scope in reversed(scopes):
+ if scope in used_scopes:
+ return scope
+
+ return 'function'
def _idval(val, argname, idx, idfn, config=None):
@@ -921,7 +936,7 @@ def _idval(val, argname, idx, idfn, config=None):
return str(argname)+str(idx)
def _idvalset(idx, valset, argnames, idfn, ids, config=None):
- if ids is None or ids[idx] is None:
+ if ids is None or (idx >= len(ids) or ids[idx] is None):
this_id = [_idval(val, argname, idx, idfn, config)
for val, argname in zip(valset, argnames)]
return "-".join(this_id)
diff --git a/_pytest/runner.py b/_pytest/runner.py
index 525a2b0..d1a1554 100644
--- a/_pytest/runner.py
+++ b/_pytest/runner.py
@@ -492,10 +492,16 @@ class Skipped(OutcomeException):
# in order to have Skipped exception printing shorter/nicer
__module__ = 'builtins'
+ def __init__(self, msg=None, pytrace=True, allow_module_level=False):
+ OutcomeException.__init__(self, msg=msg, pytrace=pytrace)
+ self.allow_module_level = allow_module_level
+
+
class Failed(OutcomeException):
""" raised from an explicit call to pytest.fail() """
__module__ = 'builtins'
+
class Exit(KeyboardInterrupt):
""" raised for immediate program exits (no tracebacks/summaries)"""
def __init__(self, msg="unknown reason"):
@@ -546,7 +552,7 @@ def importorskip(modname, minversion=None):
# Do not raise chained exception here(#1485)
should_skip = True
if should_skip:
- skip("could not import %r" %(modname,))
+ raise Skipped("could not import %r" %(modname,), allow_module_level=True)
mod = sys.modules[modname]
if minversion is None:
return mod
@@ -555,10 +561,11 @@ def importorskip(modname, minversion=None):
try:
from pkg_resources import parse_version as pv
except ImportError:
- skip("we have a required version for %r but can not import "
- "no pkg_resources to parse version strings." %(modname,))
+ raise Skipped("we have a required version for %r but can not import "
+ "pkg_resources to parse version strings." % (modname,),
+ allow_module_level=True)
if verattr is None or pv(verattr) < pv(minversion):
- skip("module %r has __version__ %r, required is: %r" %(
- modname, verattr, minversion))
+ raise Skipped("module %r has __version__ %r, required is: %r" %(
+ modname, verattr, minversion), allow_module_level=True)
return mod
diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst
index 1afee38..8613582 100644
--- a/doc/en/announce/index.rst
+++ b/doc/en/announce/index.rst
@@ -7,6 +7,8 @@ Release announcements
sprint2016
+ release-3.0.1
+ release-3.0.0
release-2.9.2
release-2.9.1
release-2.9.0
diff --git a/doc/en/announce/release-2.6.3.rst b/doc/en/announce/release-2.6.3.rst
index 13fae31..c1d0ad2 100644
--- a/doc/en/announce/release-2.6.3.rst
+++ b/doc/en/announce/release-2.6.3.rst
@@ -41,7 +41,7 @@ Changes 2.6.3
dep). Thanks Charles Cloud for analysing the issue.
- fix conftest related fixture visibility issue: when running with a
- CWD outside a test package pytest would get fixture discovery wrong.
+ CWD outside of a test package pytest would get fixture discovery wrong.
Thanks to Wolfgang Schnerring for figuring out a reproducable example.
- Introduce pytest_enter_pdb hook (needed e.g. by pytest_timeout to cancel the
diff --git a/doc/en/announce/release-3.0.0.rst b/doc/en/announce/release-3.0.0.rst
index f031840..4bf1e85 100644
--- a/doc/en/announce/release-3.0.0.rst
+++ b/doc/en/announce/release-3.0.0.rst
@@ -6,7 +6,7 @@ The pytest team is proud to announce the 3.0.0 release!
pytest is a mature Python testing tool with more than a 1600 tests
against itself, passing on many different interpreters and platforms.
-This release contains a lot of bugs and improvements, and much of
+This release contains a lot of bugs fixes and improvements, and much of
the work done on it was possible because of the 2016 Sprint[1], which
was funded by an indiegogo campaign which raised over US$12,000 with
nearly 100 backers.
@@ -76,7 +76,7 @@ Thanks to all who contributed to this release, among them:
Happy testing,
-The py.test Development Team
+The Pytest Development Team
[1] http://blog.pytest.org/2016/pytest-development-sprint/
[2] http://blog.pytest.org/2016/whats-new-in-pytest-30/
diff --git a/doc/en/announce/release-3.0.1.rst b/doc/en/announce/release-3.0.1.rst
new file mode 100644
index 0000000..9fb3804
--- /dev/null
+++ b/doc/en/announce/release-3.0.1.rst
@@ -0,0 +1,26 @@
+pytest-3.0.1
+============
+
+pytest 3.0.1 has just been released to PyPI.
+
+This release fixes some regressions reported in version 3.0.0, being a
+drop-in replacement. To upgrade:
+
+ pip install --upgrade pytest
+
+The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
+
+Thanks to all who contributed to this release, among them:
+
+ Adam Chainz
+ Andrew Svetlov
+ Bruno Oliveira
+ Daniel Hahler
+ Dmitry Dygalo
+ Florian Bruhin
+ Marcin Bachry
+ Ronny Pfannschmidt
+ matthiasha
+
+Happy testing,
+The py.test Development Team
diff --git a/doc/en/assert.rst b/doc/en/assert.rst
index 4ddc960..40fdebd 100644
--- a/doc/en/assert.rst
+++ b/doc/en/assert.rst
@@ -26,7 +26,7 @@ you will see the return value of the function call::
$ pytest test_assert1.py
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
@@ -170,7 +170,7 @@ if you run this module::
$ pytest test_assert2.py
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
diff --git a/doc/en/cache.rst b/doc/en/cache.rst
index e7784c9..d364f19 100644
--- a/doc/en/cache.rst
+++ b/doc/en/cache.rst
@@ -80,7 +80,7 @@ If you then run it with ``--lf``::
$ pytest --lf
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
run-last-failure: rerun last 2 failures
rootdir: $REGENDOC_TMPDIR, inifile:
collected 50 items
@@ -122,7 +122,7 @@ of ``FF`` and dots)::
$ pytest --ff
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
run-last-failure: rerun last 2 failures first
rootdir: $REGENDOC_TMPDIR, inifile:
collected 50 items
@@ -227,7 +227,7 @@ You can always peek at the content of the cache using the
$ py.test --cache-show
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
cachedir: $REGENDOC_TMPDIR/.cache
------------------------------- cache values -------------------------------
diff --git a/doc/en/capture.rst b/doc/en/capture.rst
index 05ed216..e4514b1 100644
--- a/doc/en/capture.rst
+++ b/doc/en/capture.rst
@@ -64,7 +64,7 @@ of the failing function and hide the other one::
$ pytest
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 2 items
diff --git a/doc/en/customize.rst b/doc/en/customize.rst
index 7ca8d12..d12a490 100644
--- a/doc/en/customize.rst
+++ b/doc/en/customize.rst
@@ -48,6 +48,16 @@ Here is the algorithm which finds the rootdir from ``args``:
directory. This allows to work with pytest in structures that are not part of
a package and don't have any particular ini-file configuration.
+If no ``args`` are given, pytest collects test below the current working
+directory and also starts determining the rootdir from there.
+
+:warning: custom pytest plugin commandline arguments may include a path, as in
+ ``pytest --log-output ../../test.log args``. Then ``args`` is mandatory,
+ otherwise pytest uses the folder of test.log for rootdir determination
+ (see also `issue 1435 <https://github.com/pytest-dev/pytest/issues/1435>`_).
+ A dot ``.`` for referencing to the current working directory is also
+ possible.
+
Note that an existing ``pytest.ini`` file will always be considered a match,
whereas ``tox.ini`` and ``setup.cfg`` will only match if they contain a
``[pytest]`` or ``[tool:pytest]`` section, respectively. Options from multiple ini-files candidates are never
diff --git a/doc/en/doctest.rst b/doc/en/doctest.rst
index 35a87ad..fa194dd 100644
--- a/doc/en/doctest.rst
+++ b/doc/en/doctest.rst
@@ -48,7 +48,7 @@ then you can just invoke ``pytest`` without command line options::
$ pytest
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
collected 1 items
diff --git a/doc/en/example/layout1/setup.cfg b/doc/en/example/layout1/setup.cfg
deleted file mode 100644
index 02d3750..0000000
--- a/doc/en/example/layout1/setup.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-[pytest]
-testfilepatterns =
- ${topdir}/tests/unit/test_${basename}
- ${topdir}/tests/functional/*.py
diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst
index b4bb743..e622b99 100644
--- a/doc/en/example/markers.rst
+++ b/doc/en/example/markers.rst
@@ -31,7 +31,7 @@ You can then restrict a test run to only run tests marked with ``webtest``::
$ pytest -v -m webtest
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
@@ -45,7 +45,7 @@ Or the inverse, running all tests except the webtest ones::
$ pytest -v -m "not webtest"
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
@@ -66,7 +66,7 @@ tests based on their module, class, method, or function name::
$ pytest -v test_server.py::TestClass::test_method
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 5 items
@@ -79,7 +79,7 @@ You can also select on the class::
$ pytest -v test_server.py::TestClass
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
@@ -92,7 +92,7 @@ Or select multiple nodes::
$ pytest -v test_server.py::TestClass test_server.py::test_send_http
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 8 items
@@ -130,7 +130,7 @@ select tests based on their names::
$ pytest -v -k http # running with the above defined example module
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
@@ -144,7 +144,7 @@ And you can also run all tests except the ones that match the keyword::
$ pytest -k "not send_http" -v
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
@@ -160,7 +160,7 @@ Or to select "http" and "quick" tests::
$ pytest -k "http or quick" -v
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
rootdir: $REGENDOC_TMPDIR, inifile:
collecting ... collected 4 items
@@ -352,7 +352,7 @@ the test needs::
$ pytest -E stage2
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
@@ -364,7 +364,7 @@ and here is one that specifies exactly the environment needed::
$ pytest -E stage1
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
@@ -485,7 +485,7 @@ then you will see two test skipped and two executed tests as expected::
$ pytest -rs # this option reports skip reasons
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items
@@ -499,7 +499,7 @@ Note that if you specify a platform via the marker-command line option like this
$ pytest -m linux2
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items
@@ -551,7 +551,7 @@ We can now use the ``-m option`` to select one set::
$ pytest -m interface --tb=short
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items
@@ -573,7 +573,7 @@ or to select both "event" and "interface" tests::
$ pytest -m "interface or event" --tb=short
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items
diff --git a/doc/en/example/nonpython.rst b/doc/en/example/nonpython.rst
index 49d476f..fd6d3b3 100644
--- a/doc/en/example/nonpython.rst
+++ b/doc/en/example/nonpython.rst
@@ -27,7 +27,7 @@ now execute the test specification::
nonpython $ pytest test_simple.yml
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
collected 2 items
@@ -59,7 +59,7 @@ consulted when reporting in ``verbose`` mode::
nonpython $ pytest -v
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1 -- $PYTHON_PREFIX/bin/python3.5
cachedir: .cache
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
collecting ... collected 2 items
@@ -81,7 +81,7 @@ interesting to just look at the collection tree::
nonpython $ pytest --collect-only
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR/nonpython, inifile:
collected 2 items
<YamlFile 'test_simple.yml'>
diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst
index 06d6ae7..70bf92c 100644
--- a/doc/en/example/parametrize.rst
+++ b/doc/en/example/parametrize.rst
@@ -130,7 +130,7 @@ objects, they are still using the default pytest representation::
$ pytest test_time.py --collect-only
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 6 items
<Module 'test_time.py'>
@@ -181,7 +181,7 @@ this is a fully self-contained example which you can run with::
$ pytest test_scenarios.py
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items
@@ -194,7 +194,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia
$ pytest --collect-only test_scenarios.py
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 4 items
<Module 'test_scenarios.py'>
@@ -259,7 +259,7 @@ Let's first see how it looks like at collection time::
$ pytest test_backends.py --collect-only
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 2 items
<Module 'test_backends.py'>
@@ -320,7 +320,7 @@ The result of this test will be successful::
$ pytest test_indirect_list.py --collect-only
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items
<Module 'test_indirect_list.py'>
@@ -447,7 +447,7 @@ If you run this with reporting for skips enabled::
$ pytest -rs test_module.py
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 2 items
diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst
index 8d778e2..d86e08b 100644
--- a/doc/en/example/pythoncollection.rst
+++ b/doc/en/example/pythoncollection.rst
@@ -117,7 +117,7 @@ then the test collection looks like this::
$ pytest --collect-only
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
collected 2 items
<Module 'check_myapp.py'>
@@ -163,7 +163,7 @@ You can always peek at the collection tree without running tests like this::
. $ pytest --collect-only pythoncollection.py
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
collected 3 items
<Module 'CWD/pythoncollection.py'>
@@ -230,7 +230,7 @@ will be left out::
$ pytest --collect-only
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
collected 0 items
diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst
index b6f4d34..45c4a8e 100644
--- a/doc/en/example/reportingdemo.rst
+++ b/doc/en/example/reportingdemo.rst
@@ -13,7 +13,7 @@ get on the terminal - we are working on that):
assertion $ pytest failure_demo.py
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR/assertion, inifile:
collected 42 items
@@ -361,7 +361,7 @@ get on the terminal - we are working on that):
> int(s)
E ValueError: invalid literal for int() with base 10: 'qwe'
- <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python.py:1174>:1: ValueError
+ <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python.py:1189>:1: ValueError
_______ TestRaises.test_raises_doesnt ________
self = <failure_demo.TestRaises object at 0xdeadbeef>
diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst
index 713b636..8c6a58b 100644
--- a/doc/en/example/simple.rst
+++ b/doc/en/example/simple.rst
@@ -108,7 +108,7 @@ directory with the above conftest.py::
$ pytest
======= test session starts ========
- platform linux -- Python 3.5.2, pytest-3.0.0, py-1.4.31, pluggy-0.3.1
+ platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR, inifile:
collected 0 items
@@ -156,7 +156,7 @@ and when running it will see a skipped "slow" test::
... 568 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pytest.git
More information about the Python-modules-commits
mailing list