Skip to content

Commit

Permalink
fix: logic for xfail test in api performance test
Browse files Browse the repository at this point in the history
  • Loading branch information
RamosFe committed Oct 27, 2023
1 parent fb31cb0 commit 425c81e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/performance/test_api/test_api_endpoints_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,14 @@ def test_api_endpoints(test_case, set_api_test_environment, api_healthcheck):
finally:
# Add useful information to report as stdout
try:
print(f'Request elapsed time: {response.elapsed.total_seconds():.3f}s\n')
print(f'Status code: {response.status_code}\n')
print(f'Full response: \n{dumps(response.json(), indent=2)}')
# If the test failed and it was expected as xfail, mark it
if test_case['endpoint'] in xfailed_items.keys() and \
test_case['method'] == xfailed_items[test_case['endpoint']]['method']:
pytest.xfail(xfailed_items[test_case['endpoint']]['message'])
else:
print(f'Request elapsed time: {response.elapsed.total_seconds():.3f}s\n')
print(f'Status code: {response.status_code}\n')
print(f'Full response: \n{dumps(response.json(), indent=2)}')
except KeyError:
print('No response available')

Expand Down

0 comments on commit 425c81e

Please sign in to comment.