Skip to content

Commit 905bd0f

Browse files
romainkomorn-exdatadogemmettbutlermabdinurbrettlangdon
authored
feat(pytest-bdd): add support for 6.1+ (#6214)
Enable support for `pytest-bdd >= 6.1` by: * Using `importlib_metadata` or `importlib.metadata` as necessary to gather package version * Switching to collection `step_func_args` after steps finish (or after they error) * Introducing a "safe" JSONification of `step_func_args` that catches possible `TypeError` exceptions and returns the error in a `json.dumps()`-safe dict Compatibility with `pytest-bdd < 4` is maintained by moving the old codepath to a utility function and using it whenever it looks like we have the old-style functions available. Technically, this maintains compatibility with `< 6.1` because that's when the latter function was removed but, based on testing, `step_func_args` is populated as expected in `>= 4.0` and our test suites pass for Python `3.6+`. The backwards-compatible code is necessary because older versions of `pytest-bdd` include fixtures in the `step_func_args` passed to the `pytest_bdd_after_step` and `pytest_bdd_step_error`, breaking `json.dumps()`. Also in this change: * Updating dependencies for testing environments * Returning `pytest-bdd` versions in `riotfile` to their state pre #4492 . Fixes #4492 . ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](../docs/contributing.rst#release-branch-maintenance)) ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](../docs/contributing.rst#release-branch-maintenance) --------- Co-authored-by: Emmett Butler <[email protected]> Co-authored-by: Munir Abdinur <[email protected]> Co-authored-by: Brett Langdon <[email protected]>
1 parent 9a3693f commit 905bd0f

File tree

17 files changed

+304
-183
lines changed

17 files changed

+304
-183
lines changed

.riot/requirements/19a842e.txt renamed to .riot/requirements/1080b30.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@
22
# This file is autogenerated by pip-compile with Python 3.7
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/19a842e.in
5+
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/1080b30.in
66
#
7-
attrs==22.2.0
8-
coverage[toml]==7.2.2
9-
exceptiongroup==1.1.1
7+
attrs==23.1.0
8+
coverage[toml]==7.2.7
9+
exceptiongroup==1.1.2
1010
glob2==0.7
1111
hypothesis==6.45.0
12-
importlib-metadata==6.0.0
12+
importlib-metadata==6.7.0
1313
iniconfig==2.0.0
1414
mako==1.2.4
15-
markupsafe==2.1.2
16-
mock==5.0.1
15+
markupsafe==2.1.3
16+
mock==5.0.2
1717
more-itertools==8.10.0
1818
msgpack==1.0.5
1919
opentracing==2.4.0
20-
packaging==23.0
21-
parse==1.19.0
22-
parse-type==0.6.0
23-
pluggy==1.0.0
20+
packaging==23.1
21+
parse==1.19.1
22+
parse-type==0.6.2
23+
pluggy==1.2.0
2424
py==1.11.0
25-
pytest==7.2.2
25+
pytest==7.4.0
2626
pytest-bdd==4.1.0
27-
pytest-cov==4.0.0
28-
pytest-mock==3.10.0
27+
pytest-cov==4.1.0
28+
pytest-mock==3.11.1
2929
six==1.16.0
3030
sortedcontainers==2.4.0
3131
tomli==2.0.1
32-
typing-extensions==4.7.0
32+
typing-extensions==4.7.1
3333
zipp==3.15.0

.riot/requirements/fc4505d.txt renamed to .riot/requirements/11ca4d2.txt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,26 @@
22
# This file is autogenerated by pip-compile with Python 3.11
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/fc4505d.in
5+
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/11ca4d2.in
66
#
7-
attrs==22.2.0
8-
coverage[toml]==7.2.2
9-
glob2==0.7
7+
attrs==23.1.0
8+
coverage[toml]==7.2.7
109
hypothesis==6.45.0
1110
iniconfig==2.0.0
1211
mako==1.2.4
13-
markupsafe==2.1.2
14-
mock==5.0.1
12+
markupsafe==2.1.3
13+
mock==5.0.2
1514
more-itertools==8.10.0
1615
msgpack==1.0.5
1716
opentracing==2.4.0
18-
packaging==23.0
19-
parse==1.19.0
20-
parse-type==0.6.0
21-
pluggy==1.0.0
22-
py==1.11.0
23-
pytest==7.2.2
24-
pytest-bdd==6.0.1
25-
pytest-cov==4.0.0
26-
pytest-mock==3.10.0
17+
packaging==23.1
18+
parse==1.19.1
19+
parse-type==0.6.2
20+
pluggy==1.2.0
21+
pytest==7.4.0
22+
pytest-bdd==6.1.1
23+
pytest-cov==4.1.0
24+
pytest-mock==3.11.1
2725
six==1.16.0
2826
sortedcontainers==2.4.0
27+
typing-extensions==4.7.1

.riot/requirements/146bb98.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.11
3+
# by the following command:
4+
#
5+
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/146bb98.in
6+
#
7+
attrs==23.1.0
8+
coverage[toml]==7.2.7
9+
hypothesis==6.45.0
10+
iniconfig==2.0.0
11+
mako==1.2.4
12+
markupsafe==2.1.3
13+
mock==5.0.2
14+
more-itertools==8.10.0
15+
msgpack==1.0.5
16+
opentracing==2.4.0
17+
packaging==23.1
18+
parse==1.19.1
19+
parse-type==0.6.2
20+
pluggy==1.2.0
21+
pytest==7.4.0
22+
pytest-bdd==6.1.1
23+
pytest-cov==4.1.0
24+
pytest-mock==3.11.1
25+
six==1.16.0
26+
sortedcontainers==2.4.0
27+
typing-extensions==4.7.1

.riot/requirements/3e8d84b.txt renamed to .riot/requirements/16a7863.txt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,28 @@
22
# This file is autogenerated by pip-compile with Python 3.8
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/3e8d84b.in
5+
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/16a7863.in
66
#
7-
attrs==22.2.0
8-
coverage[toml]==7.2.2
9-
exceptiongroup==1.1.1
10-
glob2==0.7
7+
attrs==23.1.0
8+
coverage[toml]==7.2.7
9+
exceptiongroup==1.1.2
1110
hypothesis==6.45.0
1211
iniconfig==2.0.0
1312
mako==1.2.4
14-
markupsafe==2.1.2
15-
mock==5.0.1
13+
markupsafe==2.1.3
14+
mock==5.0.2
1615
more-itertools==8.10.0
1716
msgpack==1.0.5
1817
opentracing==2.4.0
19-
packaging==23.0
20-
parse==1.19.0
21-
parse-type==0.6.0
22-
pluggy==1.0.0
23-
py==1.11.0
24-
pytest==7.2.2
25-
pytest-bdd==6.0.1
26-
pytest-cov==4.0.0
27-
pytest-mock==3.10.0
18+
packaging==23.1
19+
parse==1.19.1
20+
parse-type==0.6.2
21+
pluggy==1.2.0
22+
pytest==7.4.0
23+
pytest-bdd==6.1.1
24+
pytest-cov==4.1.0
25+
pytest-mock==3.11.1
2826
six==1.16.0
2927
sortedcontainers==2.4.0
3028
tomli==2.0.1
29+
typing-extensions==4.7.1

.riot/requirements/72a8638.txt renamed to .riot/requirements/16a9c86.txt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,28 @@
22
# This file is autogenerated by pip-compile with Python 3.9
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/72a8638.in
5+
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/16a9c86.in
66
#
7-
attrs==22.2.0
8-
coverage[toml]==7.2.2
9-
exceptiongroup==1.1.1
10-
glob2==0.7
7+
attrs==23.1.0
8+
coverage[toml]==7.2.7
9+
exceptiongroup==1.1.2
1110
hypothesis==6.45.0
1211
iniconfig==2.0.0
1312
mako==1.2.4
14-
markupsafe==2.1.2
15-
mock==5.0.1
13+
markupsafe==2.1.3
14+
mock==5.0.2
1615
more-itertools==8.10.0
1716
msgpack==1.0.5
1817
opentracing==2.4.0
19-
packaging==23.0
20-
parse==1.19.0
21-
parse-type==0.6.0
22-
pluggy==1.0.0
23-
py==1.11.0
24-
pytest==7.2.2
25-
pytest-bdd==6.0.1
26-
pytest-cov==4.0.0
27-
pytest-mock==3.10.0
18+
packaging==23.1
19+
parse==1.19.1
20+
parse-type==0.6.2
21+
pluggy==1.2.0
22+
pytest==7.4.0
23+
pytest-bdd==6.1.1
24+
pytest-cov==4.1.0
25+
pytest-mock==3.11.1
2826
six==1.16.0
2927
sortedcontainers==2.4.0
3028
tomli==2.0.1
29+
typing-extensions==4.7.1

.riot/requirements/4654b0c.txt renamed to .riot/requirements/16bf107.txt

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,30 @@
22
# This file is autogenerated by pip-compile with Python 3.7
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/4654b0c.in
5+
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/16bf107.in
66
#
7-
attrs==22.2.0
8-
coverage[toml]==7.2.2
9-
exceptiongroup==1.1.1
10-
glob2==0.7
7+
attrs==23.1.0
8+
coverage[toml]==7.2.7
9+
exceptiongroup==1.1.2
1110
hypothesis==6.45.0
12-
importlib-metadata==6.0.0
11+
importlib-metadata==6.7.0
1312
iniconfig==2.0.0
1413
mako==1.2.4
15-
markupsafe==2.1.2
16-
mock==5.0.1
14+
markupsafe==2.1.3
15+
mock==5.0.2
1716
more-itertools==8.10.0
1817
msgpack==1.0.5
1918
opentracing==2.4.0
20-
packaging==23.0
21-
parse==1.19.0
22-
parse-type==0.6.0
23-
pluggy==1.0.0
24-
py==1.11.0
25-
pytest==7.2.2
26-
pytest-bdd==6.0.1
27-
pytest-cov==4.0.0
28-
pytest-mock==3.10.0
19+
packaging==23.1
20+
parse==1.19.1
21+
parse-type==0.6.2
22+
pluggy==1.2.0
23+
pytest==7.4.0
24+
pytest-bdd==6.1.1
25+
pytest-cov==4.1.0
26+
pytest-mock==3.11.1
2927
six==1.16.0
3028
sortedcontainers==2.4.0
3129
tomli==2.0.1
32-
typing-extensions==4.7.0
30+
typing-extensions==4.7.1
3331
zipp==3.15.0

.riot/requirements/1646d28.txt renamed to .riot/requirements/1895369.txt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,30 @@
22
# This file is autogenerated by pip-compile with Python 3.9
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/1646d28.in
5+
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/1895369.in
66
#
7-
attrs==22.2.0
8-
coverage[toml]==7.2.2
9-
exceptiongroup==1.1.1
7+
attrs==23.1.0
8+
coverage[toml]==7.2.7
9+
exceptiongroup==1.1.2
1010
glob2==0.7
1111
hypothesis==6.45.0
1212
iniconfig==2.0.0
1313
mako==1.2.4
14-
markupsafe==2.1.2
15-
mock==5.0.1
14+
markupsafe==2.1.3
15+
mock==5.0.2
1616
more-itertools==8.10.0
1717
msgpack==1.0.5
1818
opentracing==2.4.0
19-
packaging==23.0
20-
parse==1.19.0
21-
parse-type==0.6.0
22-
pluggy==1.0.0
19+
packaging==23.1
20+
parse==1.19.1
21+
parse-type==0.6.2
22+
pluggy==1.2.0
2323
py==1.11.0
24-
pytest==7.2.2
24+
pytest==7.4.0
2525
pytest-bdd==4.1.0
26-
pytest-cov==4.0.0
27-
pytest-mock==3.10.0
26+
pytest-cov==4.1.0
27+
pytest-mock==3.11.1
2828
six==1.16.0
2929
sortedcontainers==2.4.0
3030
tomli==2.0.1
31+
typing-extensions==4.7.1

.riot/requirements/19a9846.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
atomicwrites==1.4.1
88
attrs==21.4.0
9-
backports.functools-lru-cache==1.6.4
9+
backports.functools-lru-cache==1.6.6
1010
configparser==4.0.2
1111
contextlib2==0.6.0.post1
1212
coverage==5.5
@@ -23,8 +23,8 @@ more-itertools==5.0.0
2323
msgpack==1.0.5
2424
opentracing==2.4.0
2525
packaging==20.9
26-
parse-type==0.6.0
27-
parse==1.19.0
26+
parse-type==0.6.2
27+
parse==1.19.1
2828
pathlib2==2.3.7.post1
2929
pluggy==0.13.1
3030
py==1.11.0

.riot/requirements/e1fad7a.txt renamed to .riot/requirements/4e21258.txt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,30 @@
22
# This file is autogenerated by pip-compile with Python 3.8
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/e1fad7a.in
5+
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/4e21258.in
66
#
7-
attrs==22.2.0
8-
coverage[toml]==7.2.2
9-
exceptiongroup==1.1.1
7+
attrs==23.1.0
8+
coverage[toml]==7.2.7
9+
exceptiongroup==1.1.2
1010
glob2==0.7
1111
hypothesis==6.45.0
1212
iniconfig==2.0.0
1313
mako==1.2.4
14-
markupsafe==2.1.2
15-
mock==5.0.1
14+
markupsafe==2.1.3
15+
mock==5.0.2
1616
more-itertools==8.10.0
1717
msgpack==1.0.5
1818
opentracing==2.4.0
19-
packaging==23.0
20-
parse==1.19.0
21-
parse-type==0.6.0
22-
pluggy==1.0.0
19+
packaging==23.1
20+
parse==1.19.1
21+
parse-type==0.6.2
22+
pluggy==1.2.0
2323
py==1.11.0
24-
pytest==7.2.2
24+
pytest==7.4.0
2525
pytest-bdd==4.1.0
26-
pytest-cov==4.0.0
27-
pytest-mock==3.10.0
26+
pytest-cov==4.1.0
27+
pytest-mock==3.11.1
2828
six==1.16.0
2929
sortedcontainers==2.4.0
3030
tomli==2.0.1
31+
typing-extensions==4.7.1

0 commit comments

Comments
 (0)