tests: only create selenium_screenshots/ on error

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-02 23:23:09 +02:00
parent ffe3ec0cb4
commit 05cc8e2b51

View file

@ -49,7 +49,6 @@ class SeleniumTestCase(StaticLiveServerTestCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.wait_timeout = 60 self.wait_timeout = 60
makedirs("selenium_screenshots/", exist_ok=True)
self.driver = self._get_driver() self.driver = self._get_driver()
self.driver.maximize_window() self.driver.maximize_window()
self.driver.implicitly_wait(30) self.driver.implicitly_wait(30)
@ -85,6 +84,7 @@ class SeleniumTestCase(StaticLiveServerTestCase):
def tearDown(self): def tearDown(self):
if "TF_BUILD" in environ: if "TF_BUILD" in environ:
makedirs("selenium_screenshots/", exist_ok=True)
screenshot_file = ( screenshot_file = (
f"selenium_screenshots/{self.__class__.__name__}_{time()}.png" f"selenium_screenshots/{self.__class__.__name__}_{time()}.png"
) )