Skip to content

Commit

Permalink
tests: don't fail on teardown if application already gone
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Kulyov <[email protected]>
  • Loading branch information
pkulev committed Jun 18, 2019
1 parent d3a0d7e commit e798334
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions xoinvader/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ def inner(mock_app=False):
return application.get_current().state

def stop():
application.get_current().deregister_state(MockedState.__name__)
if not application.get_current().states:
MockedApplication._finalize()
try:
application.get_current().deregister_state(MockedState.__name__)
except application.ApplicationNotInitializedError:
pass

request.addfinalizer(stop)

Expand Down

0 comments on commit e798334

Please sign in to comment.