Skip to content

Commit

Permalink
fixes #51: change from loop to asyncio.run
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxenceGui committed Mar 1, 2024
1 parent d94fb95 commit cbfe42c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/test_inference_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ def setUp(self) -> None:
"""
Set up the test environment before running each test case.
"""
# Start the test pipeline
self.loop = asyncio.get_event_loop()
# Start the test pipeline
self.test = app.test_client()
response = self.loop.run_until_complete(
response = asyncio.run(
self.test.get("/test")
)
self.pipeline = json.loads(asyncio.run(response.get_data()))[0]
Expand Down Expand Up @@ -73,7 +72,7 @@ def test_inference_request_successful(self, MockFromConnectionString):
}

# Test the answers from inference_request
response = self.loop.run_until_complete(
response = asyncio.run(
self.test.post(
'/inf',
headers={
Expand Down Expand Up @@ -121,7 +120,7 @@ def test_inference_request_unsuccessfull(self, MockFromConnectionString):
expected = 500

# Test the answers from inference_request
response = self.loop.run_until_complete(
response = asyncio.run(
self.test.post(
'/inf',
headers={
Expand Down Expand Up @@ -158,7 +157,7 @@ def test_inference_request_missing_argument(self):
for k, v in data.items():
if k != "model_name":
data[k] = ""
response = self.loop.run_until_complete(
response = asyncio.run(
self.test.post(
'/inf',
headers={
Expand Down Expand Up @@ -188,7 +187,7 @@ def test_inference_request_wrong_pipeline_name(self):
expected = ("Model wrong_pipeline_name not found")

# Test the answers from inference_request
response = self.loop.run_until_complete(
response = asyncio.run(
self.test.post(
'/inf',
headers={
Expand Down Expand Up @@ -217,7 +216,7 @@ def test_inference_request_wrong_header(self):
expected = ("Invalid image header")

# Test the answers from inference_request
response = self.loop.run_until_complete(
response = asyncio.run(
self.test.post(
'/inf',
headers={
Expand Down

0 comments on commit cbfe42c

Please sign in to comment.