Description
test/unit/test_kubernetes.py defines two module-level test functions with the
same name, test_kubernetes_parse_keyvalue_list (currently lines 83 and 95).
The second definition (the failure cases) shadows the first (the success cases)
in the module namespace, so pytest only ever collects the failure-case test. The
four success-case parametrizations never execute — parse_kube_keyvalue_list's
happy path is silently untested.
Steps to reproduce
python -m pytest test/unit/test_kubernetes.py --collect-only -q | grep parse_keyvalue_list
Only a single test_kubernetes_parse_keyvalue_list node is collected (the
failure case). The success-case parametrizations at lines 74–85 are absent.
Expected vs. actual
- Expected: both the success cases (4 parametrizations) and the failure
cases (2 parametrizations) are collected and run.
- Actual: only the 2 failure cases run; the 4 success cases are silently
skipped because the second def rebinds the name.
Environment
- Metaflow version: 2.19.35 (also present on current
master)
- File:
test/unit/test_kubernetes.py
Proposed fix
Rename the two functions to distinct names
(test_kubernetes_parse_keyvalue_list_success and
test_kubernetes_parse_keyvalue_list_raises) so both are collected. A PR
follows.
Description
test/unit/test_kubernetes.pydefines two module-level test functions with thesame name,
test_kubernetes_parse_keyvalue_list(currently lines 83 and 95).The second definition (the failure cases) shadows the first (the success cases)
in the module namespace, so pytest only ever collects the failure-case test. The
four success-case parametrizations never execute —
parse_kube_keyvalue_list'shappy path is silently untested.
Steps to reproduce
python -m pytest test/unit/test_kubernetes.py --collect-only -q | grep parse_keyvalue_listOnly a single
test_kubernetes_parse_keyvalue_listnode is collected (thefailure case). The success-case parametrizations at lines 74–85 are absent.
Expected vs. actual
cases (2 parametrizations) are collected and run.
skipped because the second
defrebinds the name.Environment
master)test/unit/test_kubernetes.pyProposed fix
Rename the two functions to distinct names
(
test_kubernetes_parse_keyvalue_list_successandtest_kubernetes_parse_keyvalue_list_raises) so both are collected. A PRfollows.