Commit 655a577
committed
tests: fix test_runtime.py against polluted sys.modules from earlier tests
test_notebook_oauth.py caches a fake ``databricks.sdk.runtime`` directly
in ``sys.modules`` without going through the import machinery, which
leaves the ``runtime`` attribute on ``databricks.sdk`` unset. The
previous fixture's ``import databricks.sdk.runtime`` then hit the cached
fake (skipping the loader), and the follow-up ``importlib.reload(
databricks.sdk.runtime)`` died with AttributeError when CI happened to
run test_notebook_oauth.py first.
Drop the eager import + reload from the fixture; just delitem the stale
``sys.modules`` entry via monkeypatch so the next ``import`` in the test
body triggers a fresh load (which correctly sets both ``sys.modules``
and the parent attribute). Verified locally that the suite passes both
in isolation and when ordered after test_notebook_oauth.py.1 parent 11fdf3f commit 655a577
1 file changed
Lines changed: 7 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
0 commit comments