Merge remote-tracking branch 'upstream/master' into merge-master-into-features

# Conflicts:
#	_pytest/capture.py
#	_pytest/compat.py
#	_pytest/python.py
#	testing/python/collect.py
#	testing/test_mark.py
This commit is contained in:
Bruno Oliveira
2017-05-03 19:04:53 -03:00
23 changed files with 327 additions and 99 deletions

View File

@@ -4,6 +4,7 @@ from __future__ import absolute_import, division, print_function
import fnmatch
import inspect
import sys
import os
import collections
import math
from itertools import count
@@ -20,7 +21,7 @@ from _pytest.compat import (
isclass, isfunction, is_generator, _escape_strings,
REGEX_TYPE, STRING_TYPES, NoneType, NOTSET,
get_real_func, getfslineno, safe_getattr,
getlocation, enum,
safe_str, getlocation, enum,
)
from _pytest.runner import fail
@@ -223,8 +224,7 @@ class PyobjMixin(PyobjContext):
continue
name = node.name
if isinstance(node, Module):
assert name.endswith(".py")
name = name[:-3]
name = os.path.splitext(name)[0]
if stopatmodule:
if includemodule:
parts.append(name)
@@ -427,7 +427,7 @@ class Module(main.File, PyCollector):
if self.config.getoption('verbose') < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = exc_info.getrepr(style='short') if exc_info.traceback else exc_info.exconly()
formatted_tb = py._builtin._totext(exc_repr)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
@@ -843,7 +843,11 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
for callspec in self._calls or [CallSpec2(self)]:
elements = zip(ids, parameters, count())
for a_id, param, param_index in elements:
assert len(param.values) == len(argnames)
if len(param.values) != len(argnames):
raise ValueError(
'In "parametrize" the number of values ({0}) must be '
'equal to the number of names ({1})'.format(
param.values, argnames))
newcallspec = callspec.copy(self)
newcallspec.setmulti(valtypes, argnames, param.values, a_id,
param.deprecated_arg_dict, scopenum, param_index)