From eaca9e09a1bf914a307c0581a50b49078023f252 Mon Sep 17 00:00:00 2001 From: Marcel Wilson Date: Fri, 13 Oct 2023 11:52:14 -0500 Subject: [PATCH] using the handy fixture to delete the cache folder --- tests/test_chrome_driver.py | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/tests/test_chrome_driver.py b/tests/test_chrome_driver.py index 611719d3..fa2096bf 100644 --- a/tests/test_chrome_driver.py +++ b/tests/test_chrome_driver.py @@ -108,43 +108,27 @@ def test_can_get_chrome_for_os(os_type): assert os.path.exists(path) -def test_can_get_chrome_for_win64(): +def test_can_get_chrome_for_win64(delete_drivers_dir): os_sys_manager = OperationSystemManager("win64") - # using random folder to avoid using any possible cache - cache_manager = DriverCacheManager(os.path.join(".test", f"win64_{random()}")) - path = ChromeDriverManager( - os_system_manager=os_sys_manager, cache_manager=cache_manager - ).install() + path = ChromeDriverManager(os_system_manager=os_sys_manager).install() assert os.path.basename(os.path.dirname(path)) == "chromedriver-win64" -def test_can_get_chrome_for_win32(): +def test_can_get_chrome_for_win32(delete_drivers_dir): os_sys_manager = OperationSystemManager("win32") - # using random folder to avoid using any possible cache - cache_manager = DriverCacheManager(os.path.join(".test", f"win32_{random()}")) - path = ChromeDriverManager( - os_system_manager=os_sys_manager, cache_manager=cache_manager - ).install() + path = ChromeDriverManager(os_system_manager=os_sys_manager).install() assert os.path.basename(os.path.dirname(path)) == "chromedriver-win32" @patch("webdriver_manager.core.os_manager.platform") -def test_can_get_chrome_for_mac64(mock_platform): +def test_can_get_chrome_for_mac64(mock_platform, delete_drivers_dir): mock_platform.processor = create_autospec(platform.processor, return_value="i386") os_sys_manager = OperationSystemManager("mac64") - # using random folder to avoid using any possible cache - cache_manager = DriverCacheManager(os.path.join(".test", f"mac64_{random()}")) - path = ChromeDriverManager( - os_system_manager=os_sys_manager, cache_manager=cache_manager - ).install() + path = ChromeDriverManager(os_system_manager=os_sys_manager).install() assert os.path.basename(os.path.dirname(path)) == "chromedriver-mac-x64" -def test_can_get_chrome_for_mac64_m1(): +def test_can_get_chrome_for_mac64_m1(delete_drivers_dir): os_sys_manager = OperationSystemManager("mac64_m1") - # using random folder to avoid using any possible cache - cache_manager = DriverCacheManager(os.path.join(".test", f"mac64_m1_{random()}")) - path = ChromeDriverManager( - os_system_manager=os_sys_manager, cache_manager=cache_manager - ).install() + path = ChromeDriverManager(os_system_manager=os_sys_manager).install() assert os.path.basename(os.path.dirname(path)) == "chromedriver-mac-arm64"