Skip to content

Commit af56f11

Browse files
committed
Make tests discovery compatible with pytest 6
The 'args' keyword for the pytest.Function.from_parent constructor was removed with pytest 6. It was unused in pytest [1] and was always an empty tuple in the sasmodels code. [1] pytest-dev/pytest#7226
1 parent c43c219 commit af56f11

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

conftest.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def build_test(test, value):
5353
if collector.istestfunction(obj, name) and is_generator(obj):
5454
tests = []
5555
for number, yielded in enumerate(obj()):
56-
index, call, args = split_yielded_test(yielded, number)
56+
index, call = split_yielded_test(yielded, number)
5757
description = getattr(call, 'description', name+index)
5858
test = function_test(
59-
parent=collector, name=description, args=args, callobj=call)
59+
parent=collector, name=description, callobj=call)
6060
tests.append(test)
6161
return tests
6262

@@ -74,13 +74,10 @@ def is_generator(func):
7474
def split_yielded_test(obj, number):
7575
if not isinstance(obj, (tuple, list)):
7676
obj = (obj,)
77-
if not callable(obj[0]):
78-
index = "['%s']"%obj[0]
79-
obj = obj[1:]
80-
else:
81-
index = "[%d]"%number
82-
call, args = obj[0], obj[1:]
83-
return index, call, args
77+
assert callable(obj[0])
78+
index = "[%d]"%number
79+
call = obj[0]
80+
return index, call
8481

8582
USE_DOCSTRING_AS_DESCRIPTION = True
8683
def pytest_collection_modifyitems(session, config, items):

0 commit comments

Comments
 (0)