Merge pull request #101 from ktp420/zombie_browsers

Cleanup browser and other process if setup fails
This commit is contained in:
Michael Mintz 2017-05-16 16:53:22 -04:00 committed by GitHub
commit e06454faca
1 changed files with 16 additions and 3 deletions

View File

@ -128,8 +128,21 @@ def pytest_runtest_setup():
pass
def pytest_runtest_teardown():
""" This runs after every test with pytest """
def pytest_runtest_teardown(item):
try:
self = item._testcase
try:
if hasattr(self, 'driver') and self.driver:
self.driver.quit()
except:
pass
try:
if hasattr(self, 'headless') and self.headless:
if self.headless_active:
self.display.stop()
except:
pass
except:
pass