Repository navigation
Commit e8edd7e
test(train): make hyperparameters-file tests robust to global open/exists calls (#6561)
test_hyperparameters_valid_json and test_hyperparameters_valid_yaml patch
os.path.exists and builtins.open globally and assert them with
assert_called_once_with. Those are exact-count assertions on global built-ins,
so any unrelated exists/open call surfacing during a full-suite run makes them
fail intermittently with "Expected 'open'/'exists' to be called once. Called 2
times" — observed on unrelated PR CI runs for both the json and yaml variants.
Switch the two assertions in each test to assert_any_call. This still verifies
the meaningful behavior (the hyperparameters file is checked for existence and
opened for reading) without being brittle to unrelated global calls. No product
code change; the loader still opens the file exactly once.
Co-authored-by: Mufaddal Rohawala <mufi@amazon.com>1 parent bd53b10 commit e8edd7e
1 file changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1616 | 1616 | | |
1617 | 1617 | | |
1618 | 1618 | | |
1619 | | - | |
1620 | | - | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
1621 | 1625 | | |
1622 | 1626 | | |
1623 | 1627 | | |
| |||
1635 | 1639 | | |
1636 | 1640 | | |
1637 | 1641 | | |
1638 | | - | |
1639 | | - | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
1640 | 1648 | | |
1641 | 1649 | | |
1642 | 1650 | | |
| |||
0 commit comments