metaflow icon indicating copy to clipboard operation
metaflow copied to clipboard

Duplicate test name in test_kubernetes.py silently skips parse_kube_keyvalue_list success cases

Open prabhaharanv opened this issue 4 months ago • 0 comments

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.

prabhaharanv avatar Jul 25 '26 07:07 prabhaharanv