Skip to content

Commit ed65a6c

Browse files
Assert return value of expected_http_error (#1308)
Co-authored-by: Matt Wiese <[email protected]>
1 parent a25440c commit ed65a6c

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

jupyter_server/services/events/handlers.py

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ async def post(self):
110110
)
111111
self.set_status(204)
112112
self.finish()
113+
except web.HTTPError:
114+
raise
113115
except Exception as e:
114116
raise web.HTTPError(500, str(e)) from e
115117

tests/services/contents/test_manager.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -448,19 +448,19 @@ async def test_escape_root(jp_file_contents_manager_class, tmp_path):
448448

449449
with pytest.raises(HTTPError) as e:
450450
await ensure_async(cm.get(".."))
451-
expected_http_error(e, 404)
451+
assert expected_http_error(e, 404)
452452

453453
with pytest.raises(HTTPError) as e:
454454
await ensure_async(cm.get("foo/../../../bar"))
455-
expected_http_error(e, 404)
455+
assert expected_http_error(e, 404)
456456

457457
with pytest.raises(HTTPError) as e:
458458
await ensure_async(cm.delete("../foo"))
459-
expected_http_error(e, 404)
459+
assert expected_http_error(e, 404)
460460

461461
with pytest.raises(HTTPError) as e:
462462
await ensure_async(cm.rename("../foo", "../bar"))
463-
expected_http_error(e, 404)
463+
assert expected_http_error(e, 404)
464464

465465
with pytest.raises(HTTPError) as e:
466466
await ensure_async(
@@ -473,7 +473,7 @@ async def test_escape_root(jp_file_contents_manager_class, tmp_path):
473473
path="../foo",
474474
)
475475
)
476-
expected_http_error(e, 404)
476+
assert expected_http_error(e, 404)
477477

478478

479479
async def test_new_untitled(jp_contents_manager):

tests/services/events/test_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ async def test_post_event_400(jp_fetch, event_logger, payload):
123123
with pytest.raises(tornado.httpclient.HTTPClientError) as e:
124124
await jp_fetch("api", "events", method="POST", body=payload)
125125

126-
expected_http_error(e, 400)
126+
assert expected_http_error(e, 400)
127127

128128

129129
payload_7 = """\
@@ -152,4 +152,4 @@ async def test_post_event_500(jp_fetch, event_logger, payload):
152152
with pytest.raises(tornado.httpclient.HTTPClientError) as e:
153153
await jp_fetch("api", "events", method="POST", body=payload)
154154

155-
expected_http_error(e, 500)
155+
assert expected_http_error(e, 500)

0 commit comments

Comments
 (0)