Skip to content

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

Description

@prabhaharanv

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions