Skip to content

Commit

Permalink
Avoids unnecessary calls when pytest API fixture fails
Browse files Browse the repository at this point in the history
  • Loading branch information
aaront committed Oct 10, 2024
1 parent 10d5d55 commit 9262637
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/test_api_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def async_populated_api():
session = API(USERNAME, password=PASSWORD, database=DATABASE, server=SERVER, cert=cert)
try:
session.authenticate()
except MyGeotabException as exception:
pytest.fail(exception)
except (MyGeotabException, AuthenticationException) as exception:
pytest.fail(str(exception))
return
yield session
else:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_api_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def populated_api():
session = api.API(USERNAME, password=PASSWORD, database=DATABASE, server=SERVER, cert=cert)
try:
session.authenticate()
except api.MyGeotabException as exception:
pytest.fail(exception)
except (api.MyGeotabException, api.AuthenticationException) as exception:
pytest.fail(str(exception))
return
yield session
else:
Expand Down

0 comments on commit 9262637

Please sign in to comment.