Skip to content

Commit 3b0b81b

Browse files
committed
Clean up deprecated tests
I've removed a test that mixed old and new syntax (the code it tests is tested elsewhere), and added a README to explain why we have a folder of almost-duplicated tests.
1 parent a5638cf commit 3b0b81b

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Old-style dependency tests
2+
3+
The test files in this folder use the old (pre-v0.0.12) dependency mechanism. This will be removed in v0.0.13, and these tests are preserved here to ensure they work until then. Test files of the same name exist in the parent module, but they have been migrated to use the newer syntax (i.e. not to use dependencies). As of v0.0.13, this folder will be deleted, and the duplication will go away.
4+
5+
It felt cleaner to duplicate the tests temporarily, rather than try to test two different forms of the syntax in the same file. This way, we keep the old syntax out of the test suite, preserving enough to check it's not broken until it moves from deprecated to gone.

tests/old_dependency_tests/test_dependency_metadata.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def thing_state(self):
3838
return {"a": 1}
3939

4040
@lt.thing_action
41-
def count_and_watch_deprecated(
41+
def count_and_watch(
4242
self, thing_one: ThingOneDep, get_metadata: lt.deps.GetThingStates
4343
) -> Mapping[str, Mapping[str, Any]]:
4444
metadata = {}
@@ -47,16 +47,6 @@ def count_and_watch_deprecated(
4747
metadata[f"a_{a}"] = get_metadata()
4848
return metadata
4949

50-
@lt.thing_action
51-
def count_and_watch(
52-
self, thing_one: ThingOneDep
53-
) -> Mapping[str, Mapping[str, Any]]:
54-
metadata = {}
55-
for a in self.A_VALUES:
56-
thing_one.a = a
57-
metadata[f"a_{a}"] = self._thing_server_interface.get_thing_states()
58-
return metadata
59-
6050

6151
@pytest.fixture
6252
def client():
@@ -80,14 +70,3 @@ def test_fresh_metadata(client):
8070
for a in ThingTwo.A_VALUES:
8171
assert out[f"a_{a}"]["thing_one"]["a"] == a
8272
assert out[f"a_{a}"]["thing_two"]["a"] == 1
83-
84-
85-
def test_fresh_metadata_deprecated(client):
86-
"""Test that the old metadata dependency retrieves fresh metadata."""
87-
r = client.post("/thing_two/count_and_watch_deprecated")
88-
invocation = poll_task(client, r.json())
89-
assert invocation["status"] == "completed"
90-
out = invocation["output"]
91-
for a in ThingTwo.A_VALUES:
92-
assert out[f"a_{a}"]["thing_one"]["a"] == a
93-
assert out[f"a_{a}"]["thing_two"]["a"] == 1

0 commit comments

Comments
 (0)