Skip to content

Commit

Permalink
using the handy fixture to delete the cache folder
Browse files Browse the repository at this point in the history
  • Loading branch information
bandophahita committed Oct 13, 2023
1 parent b43ca10 commit eaca9e0
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions tests/test_chrome_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit eaca9e0

Please sign in to comment.