Commit ac3c86f
committed
fix(tests): pytest 9 + xdist compat (subTest serialization)
Three independent fixes surfaced by the dep bump's pytest 7 → 9 jump:
1) pytest 9 + xdist 3.8 serializes subTest parametrization across worker
process boundaries via execnet. Class objects (thrift response types)
and thrift instances are not pickleable through execnet's restricted
serializer. Replace them with string labels:
- tests/unit/test_thrift_backend.py:
* resp_type / exec_resp_type → resp_type.__name__
* op_state_resp thrift instance → ("error_resp"/"closed_resp", inst) tuple
* error_resp thrift instance → f"resp_{i}" index label
- tests/unit/test_endpoint.py:
* CloudType enum → .value
Net effect: every subTest now passes only str/int/None to the subTest
keyword args. Test coverage is unchanged — the labels still uniquely
identify which subtest failed.
2) urllib3 2.x adds a `version_string` attribute that retry handlers
read off the response object. tests/e2e/common/retry_test_mixins.py's
SimpleHttpResponse mock missed this attribute; add it.
3) pyjwt 2.13.0's stricter type signatures expose a pre-existing mypy
`Incompatible return value type` warning in oauth.py — `exp_time and
(exp_time - buffer_time) <= current_time` returns Any|None, not bool.
Wrap exp_time in bool() to satisfy mypy without changing semantics
(None and False are both falsy; result is identical for all inputs).
Also updates poetry.lock for the pytest line (`^8.4.0` -> `^9.0.3`
restoration; intermediate downgrade was an investigation step, now
reverted).
Local verification on Python 3.10.18:
poetry run pytest tests/unit/ -n auto 765 passed, 4 skipped
~/osv-scanner scan source --lockfile poetry.lock No issues found
Co-authored-by: Isaac
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>1 parent dfac273 commit ac3c86f
5 files changed
Lines changed: 21 additions & 27 deletions
File tree
- src/databricks/sql/auth
- tests
- e2e/common
- unit
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
100 | | - | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
599 | | - | |
| 599 | + | |
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
| |||
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
690 | | - | |
| 690 | + | |
| 691 | + | |
691 | 692 | | |
| 693 | + | |
692 | 694 | | |
693 | | - | |
| 695 | + | |
694 | 696 | | |
695 | 697 | | |
696 | 698 | | |
| |||
850 | 852 | | |
851 | 853 | | |
852 | 854 | | |
853 | | - | |
854 | | - | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
855 | 859 | | |
856 | 860 | | |
857 | 861 | | |
| |||
874 | 878 | | |
875 | 879 | | |
876 | 880 | | |
877 | | - | |
| 881 | + | |
878 | 882 | | |
879 | 883 | | |
880 | 884 | | |
| |||
937 | 941 | | |
938 | 942 | | |
939 | 943 | | |
940 | | - | |
| 944 | + | |
941 | 945 | | |
942 | 946 | | |
943 | 947 | | |
| |||
1041 | 1045 | | |
1042 | 1046 | | |
1043 | 1047 | | |
1044 | | - | |
| 1048 | + | |
1045 | 1049 | | |
1046 | 1050 | | |
1047 | 1051 | | |
| |||
1087 | 1091 | | |
1088 | 1092 | | |
1089 | 1093 | | |
1090 | | - | |
| 1094 | + | |
1091 | 1095 | | |
1092 | 1096 | | |
1093 | 1097 | | |
| |||
0 commit comments