Skip to content

Commit b411cfa

Browse files
youtuxolegpidsadnyi
authored andcommitted
(supposedly) drop compatibility with pytest < 3.3.2
The test suite still passes with all the pytests >= 3, so I wonder if I actually broke the compatibility
1 parent ee05a10 commit b411cfa

File tree

3 files changed

+2
-36
lines changed

3 files changed

+2
-36
lines changed

CHANGES.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Changelog
44
Unreleased
55
----------
66

7-
- Drop support for pytest < 3.0
7+
- Drop support for pytest < 3.3
88

99
3.0.2
1010
------

pytest_bdd/steps.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ def article(author):
4949
StepError,
5050
)
5151
from .parsers import get_parser
52-
from .utils import get_args, get_fixture_value_raw, set_fixture_value, get_request_fixture_defs, \
53-
get_request_fixture_names
52+
from .utils import get_args, get_request_fixture_defs, get_request_fixture_names
5453

5554

5655
def get_step_fixture_name(name, type_, encoding=None):
@@ -308,23 +307,18 @@ def inject_fixture(request, arg, value):
308307
old_fd = get_request_fixture_defs(request).get(arg)
309308
add_fixturename = arg not in request.fixturenames
310309

311-
old_value = get_fixture_value_raw(request, arg) # Compatibility with pytest < 3.3.2
312-
313310
def fin():
314311
request._fixturemanager._arg2fixturedefs[arg].remove(fd)
315312
get_request_fixture_defs(request)[arg] = old_fd
316313

317314
if add_fixturename:
318315
get_request_fixture_names(request).remove(arg)
319316

320-
set_fixture_value(request, arg, old_value) # Compatibility with pytest < 3.3.2
321-
322317
request.addfinalizer(fin)
323318

324319
# inject fixture definition
325320
request._fixturemanager._arg2fixturedefs.setdefault(arg, []).insert(0, fd)
326321
# inject fixture value in request cache
327322
get_request_fixture_defs(request)[arg] = fd
328-
set_fixture_value(request, arg, value)
329323
if add_fixturename:
330324
get_request_fixture_names(request).append(arg)

pytest_bdd/utils.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,6 @@ def get_args(func):
2525
return inspect.getargspec(func).args
2626

2727

28-
def get_fixture_value_raw(request, name):
29-
"""Set the given raw fixture value from the pytest request object.
30-
31-
:note: Compatibility with pytest < 3.3.2
32-
"""
33-
try:
34-
return request._fixture_values.get(name)
35-
except AttributeError:
36-
try:
37-
return request._funcargs.get(name)
38-
except AttributeError:
39-
pass
40-
41-
42-
def set_fixture_value(request, name, value):
43-
"""Set the given fixture value on the pytest request object.
44-
45-
:note: Compatibility with pytest < 3.3.2
46-
"""
47-
try:
48-
request._fixture_values[name] = value
49-
except AttributeError:
50-
try:
51-
request._funcargs[name] = value
52-
except AttributeError:
53-
pass
54-
55-
5628
def get_request_fixture_defs(request):
5729
"""Get the internal list of FixtureDefs cached into the given request object.
5830

0 commit comments

Comments
 (0)