Merge branch 'master' into features

This commit is contained in:
Daniel Hahler
2018-11-09 12:49:55 +01:00
16 changed files with 58 additions and 23 deletions

View File

@@ -477,6 +477,11 @@ class PytestPluginManager(PluginManager):
def consider_pluginarg(self, arg):
if arg.startswith("no:"):
name = arg[3:]
# PR #4304 : remove stepwise if cacheprovider is blocked
if name == "cacheprovider":
self.set_blocked("stepwise")
self.set_blocked("pytest_stepwise")
self.set_blocked(name)
if not name.startswith("pytest_"):
self.set_blocked("pytest_" + name)

View File

@@ -927,7 +927,7 @@ class FixtureDef(object):
return hook.pytest_fixture_setup(fixturedef=self, request=request)
def __repr__(self):
return "<FixtureDef name=%r scope=%r baseid=%r>" % (
return "<FixtureDef argname=%r scope=%r baseid=%r>" % (
self.argname,
self.scope,
self.baseid,

View File

@@ -279,7 +279,7 @@ def pytest_ignore_collect(path, config):
return True
allow_in_venv = config.getoption("collect_in_virtualenv")
if _in_venv(path) and not allow_in_venv:
if not allow_in_venv and _in_venv(path):
return True
return False
@@ -511,9 +511,9 @@ class Session(nodes.FSCollector):
# No point in finding packages when collecting doctests
if not self.config.option.doctestmodules:
pm = self.config.pluginmanager
for parent in argpath.parts():
for parent in reversed(argpath.parts()):
if pm._confcutdir and pm._confcutdir.relto(parent):
continue
break
if parent.isdir():
pkginit = parent.join("__init__.py")

View File

@@ -1160,11 +1160,11 @@ class Testdir(object):
def runpytest_subprocess(self, *args, **kwargs):
"""Run pytest as a subprocess with given arguments.
Any plugins added to the :py:attr:`plugins` list will added using the
``-p`` command line option. Additionally ``--basetemp`` is used put
Any plugins added to the :py:attr:`plugins` list will be added using the
``-p`` command line option. Additionally ``--basetemp`` is used to put
any temporary files and directories in a numbered directory prefixed
with "runpytest-" so they do not conflict with the normal numbered
pytest location for temporary files and directories.
with "runpytest-" to not conflict with the normal numbered pytest
location for temporary files and directories.
:param args: the sequence of arguments to pass to the pytest subprocess
:param timeout: the period in seconds after which to timeout and raise

View File

@@ -497,7 +497,10 @@ class TerminalReporter(object):
if not final:
# Only write "collecting" report every 0.5s.
t = time.time()
if self._collect_report_last_write > t - 0.5:
if (
self._collect_report_last_write is not None
and self._collect_report_last_write > t - 0.5
):
return
self._collect_report_last_write = t