better details handling
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m31s
Run linting on the backend code / Build (pull_request) Failing after 30s
Run testing on the backend code / Build (pull_request) Failing after 1m47s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 15s

This commit is contained in:
Helldragon67 2024-11-21 15:36:20 +01:00
parent b56647f12e
commit d35ff30864
2 changed files with 15 additions and 15 deletions

View File

@ -33,6 +33,7 @@ jobs:
working-directory: backend
- name: Upload HTML report
if: always()
uses: https://gitea.com/actions/upload-artifact@v3
with:
name: pytest-html-report

View File

@ -35,13 +35,8 @@ def test_turckheim(client, request):
result = response.json()
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
# Create the trip string
trip_string = [f"{landmark.name} ({landmark.attractiveness} | {landmark.duration}) - {landmark.time_to_reach_next}" for landmark in landmarks]
# Pass additional info to pytest for reporting
request.node.trip_details = trip_string
request.node.trip_duration = str(result['total_time'])
request.node.target_duration = str(duration_minutes)
# Add details to report
log_trip_details(request, landmarks, result['total_time'], duration_minutes)
# checks :
assert response.status_code == 200 # check for successful planning
@ -52,7 +47,7 @@ def test_turckheim(client, request):
# Test no. 3
def test_bellecour(client, request) :
duration_minutes = 50
duration_minutes = 60
response = client.post(
"/trip/new",
json={
@ -64,13 +59,8 @@ def test_bellecour(client, request) :
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
osm_ids = landmarks_to_osmid(landmarks)
# Create the trip string
trip_string = [f"{landmark.name} ({landmark.attractiveness}) - {landmark.time_to_reach_next}" for landmark in landmarks]
# Pass additional info to pytest for reporting
request.node.trip_details = trip_string
request.node.trip_duration = str(result['total_time'])
request.node.target_duration = str(duration_minutes)
# Add details to report
log_trip_details(request, landmarks, result['total_time'], duration_minutes)
# checks :
assert response.status_code == 200 # check for successful planning
@ -144,6 +134,15 @@ def load_trip_landmarks(client, first_uuid: str) -> List[Landmark]:
return landmarks
def log_trip_details(request, landmarks: List[Landmark], duration: int, target_duration: int) :
# Create the trip string
trip_string = [f"{landmark.name} ({landmark.attractiveness} | {landmark.duration}) - {landmark.time_to_reach_next}" for landmark in landmarks]
# Pass additional info to pytest for reporting
request.node.trip_details = trip_string
request.node.trip_duration = str(duration) # result['total_time']
request.node.target_duration = str(target_duration)
# def test_new_trip_single_prefs(client):