Merge master into features

This commit is contained in:
Daniel Hahler
2018-11-19 12:55:29 +01:00
12 changed files with 69 additions and 24 deletions
+2 -1
View File
@@ -946,7 +946,8 @@ class AssertionRewriter(ast.NodeVisitor):
def visit_Starred(self, starred):
# From Python 3.5, a Starred node can appear in a function call
res, expl = self.visit(starred.value)
return starred, "*" + expl
new_starred = ast.Starred(res, starred.ctx)
return new_starred, "*" + expl
def visit_Call_legacy(self, call):
"""
+1 -4
View File
@@ -852,10 +852,7 @@ class Config(object):
)
if not args:
if self.invocation_dir == self.rootdir:
args = [
str(self.invocation_dir.join(x, abs=True))
for x in self.getini("testpaths")
]
args = self.getini("testpaths")
if not args:
args = [str(self.invocation_dir)]
self.args = args
+3
View File
@@ -518,6 +518,9 @@ class Testdir(object):
def __repr__(self):
return "<Testdir %r>" % (self.tmpdir,)
def __str__(self):
return str(self.tmpdir)
def finalize(self):
"""Clean up global state artifacts.
+5 -5
View File
@@ -741,16 +741,20 @@ class FunctionMixin(PyobjMixin):
class Generator(FunctionMixin, PyCollector):
def collect(self):
# test generators are seen as collectors but they also
# invoke setup/teardown on popular request
# (induced by the common "test_*" naming shared with normal tests)
from _pytest import deprecated
self.warn(deprecated.YIELD_TESTS)
self.session._setupstate.prepare(self)
# see FunctionMixin.setup and test_setupstate_is_preserved_134
self._preservedparent = self.parent.obj
values = []
seen = {}
_Function = self._getcustomclass("Function")
for i, x in enumerate(self.obj()):
name, call, args = self.getcallargs(x)
if not callable(call):
@@ -764,11 +768,7 @@ class Generator(FunctionMixin, PyCollector):
"%r generated tests with non-unique name %r" % (self, name)
)
seen[name] = True
with warnings.catch_warnings():
# ignore our own deprecation warning
function_class = self.Function
values.append(function_class(name, self, args=args, callobj=call))
self.warn(deprecated.YIELD_TESTS)
values.append(_Function(name, self, args=args, callobj=call))
return values
def getcallargs(self, obj):