Skip to content

Commit 9262637

Browse files
committed
Avoids unnecessary calls when pytest API fixture fails
1 parent 10d5d55 commit 9262637

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/test_api_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def async_populated_api():
3838
session = API(USERNAME, password=PASSWORD, database=DATABASE, server=SERVER, cert=cert)
3939
try:
4040
session.authenticate()
41-
except MyGeotabException as exception:
42-
pytest.fail(exception)
41+
except (MyGeotabException, AuthenticationException) as exception:
42+
pytest.fail(str(exception))
4343
return
4444
yield session
4545
else:

tests/test_api_call.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def populated_api():
4848
session = api.API(USERNAME, password=PASSWORD, database=DATABASE, server=SERVER, cert=cert)
4949
try:
5050
session.authenticate()
51-
except api.MyGeotabException as exception:
52-
pytest.fail(exception)
51+
except (api.MyGeotabException, api.AuthenticationException) as exception:
52+
pytest.fail(str(exception))
5353
return
5454
yield session
5555
else:

0 commit comments

Comments
 (0)