Skip to content

Commit 75c75b9

Browse files
committed
Fix assertion for duplicate actions
I added more actions to the example Thing in conftest, so I now need slightly cleverer code to make sure I'm testing for duplicate action names.
1 parent 89c1ddf commit 75c75b9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

tests/test_openapi.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ def post(self):
4141
with pytest.warns(UserWarning):
4242
t.add_view(TestAction, "TestActionM", endpoint="TestActionM")
4343

44+
# We should have two actions with the same name
45+
actions_named_testaction = 0
4446
for v in t._action_views.values():
45-
# We should have two actions with the same name
46-
assert v.__name__ == "TestAction"
47+
if v.__name__ == "TestAction":
48+
actions_named_testaction += 1
49+
assert actions_named_testaction >= 2
4750

4851
api = t.spec.to_dict()
4952
original_input_schema = get_by_path(api, ["paths", "/TestAction", "post"])

tests/test_tasks_thread.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def task_func():
115115
assert task_obj.get(block=False, timeout=0)
116116

117117

118+
@pytest.mark.filterwarnings("ignore:Exception in thread")
118119
def test_task_exception():
119120
exc_to_raise = Exception("Exception message")
120121

0 commit comments

Comments
 (0)