better logs
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m20s
Run linting on the backend code / Build (pull_request) Failing after 26s
Run testing on the backend code / Build (pull_request) Failing after 2m40s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 17s
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m20s
Run linting on the backend code / Build (pull_request) Failing after 26s
Run testing on the backend code / Build (pull_request) Failing after 2m40s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 17s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Collection of tests to ensure correct implementation and track progress. """
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
import pytest
|
||||
import pytest, time
|
||||
|
||||
from .test_utils import landmarks_to_osmid, load_trip_landmarks, log_trip_details
|
||||
from ..main import app
|
||||
@@ -20,7 +20,9 @@ def test_turckheim(client, request): # pylint: disable=redefined-outer-name
|
||||
client:
|
||||
request:
|
||||
"""
|
||||
start_time = time.time() # Start timer
|
||||
duration_minutes = 15
|
||||
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
@@ -35,6 +37,9 @@ def test_turckheim(client, request): # pylint: disable=redefined-outer-name
|
||||
result = response.json()
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
# Get computation time
|
||||
comp_time = time.time() - start_time
|
||||
|
||||
# Add details to report
|
||||
log_trip_details(request, landmarks, result['total_time'], duration_minutes)
|
||||
|
||||
@@ -43,6 +48,7 @@ def test_turckheim(client, request): # pylint: disable=redefined-outer-name
|
||||
assert isinstance(landmarks, list) # check that the return type is a list
|
||||
assert duration_minutes*0.8 < int(result['total_time']) < duration_minutes*1.2
|
||||
assert len(landmarks) > 2 # check that there is something to visit
|
||||
assert comp_time < 30, f"Computation time exceeded 30 seconds: {comp_time:.2f} seconds"
|
||||
|
||||
|
||||
def test_bellecour(client, request) : # pylint: disable=redefined-outer-name
|
||||
@@ -53,7 +59,9 @@ def test_bellecour(client, request) : # pylint: disable=redefined-outer-name
|
||||
client:
|
||||
request:
|
||||
"""
|
||||
start_time = time.time() # Start timer
|
||||
duration_minutes = 120
|
||||
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
@@ -67,7 +75,9 @@ def test_bellecour(client, request) : # pylint: disable=redefined-outer-name
|
||||
)
|
||||
result = response.json()
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
osm_ids = landmarks_to_osmid(landmarks)
|
||||
|
||||
# Get computation time
|
||||
comp_time = time.time() - start_time
|
||||
|
||||
# Add details to report
|
||||
log_trip_details(request, landmarks, result['total_time'], duration_minutes)
|
||||
@@ -79,8 +89,7 @@ def test_bellecour(client, request) : # pylint: disable=redefined-outer-name
|
||||
# checks :
|
||||
assert response.status_code == 200 # check for successful planning
|
||||
assert duration_minutes*0.8 < int(result['total_time']) < duration_minutes*1.2
|
||||
assert 136200148 in osm_ids # check for Cathédrale St. Jean in trip
|
||||
# assert response.status_code == 2000 # check for successful planning
|
||||
assert comp_time < 30, f"Computation time exceeded 30 seconds: {comp_time:.2f} seconds"
|
||||
|
||||
|
||||
|
||||
@@ -92,7 +101,9 @@ def test_shopping(client, request) : # pylint: disable=redefined-outer-name
|
||||
client:
|
||||
request:
|
||||
"""
|
||||
start_time = time.time() # Start timer
|
||||
duration_minutes = 240
|
||||
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
@@ -107,12 +118,16 @@ def test_shopping(client, request) : # pylint: disable=redefined-outer-name
|
||||
result = response.json()
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
# Get computation time
|
||||
comp_time = time.time() - start_time
|
||||
|
||||
# Add details to report
|
||||
log_trip_details(request, landmarks, result['total_time'], duration_minutes)
|
||||
|
||||
# checks :
|
||||
assert response.status_code == 200 # check for successful planning
|
||||
assert duration_minutes*0.8 < int(result['total_time']) < duration_minutes*1.2
|
||||
assert comp_time < 30, f"Computation time exceeded 30 seconds: {comp_time:.2f} seconds"
|
||||
|
||||
# def test_new_trip_single_prefs(client):
|
||||
# response = client.post(
|
||||
|
Reference in New Issue
Block a user