-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move fixtures to conftest.
- Loading branch information
Showing
4 changed files
with
88 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,47 @@ | ||
from pathlib import Path | ||
import sys | ||
import pytest | ||
import shutil | ||
|
||
sys.path.insert(0, str(Path(__file__).parent.parent)) | ||
from yadc.browser import Browser | ||
|
||
|
||
def executable_path(*tries): | ||
"""Find path to executable, or throw.""" | ||
path = None | ||
for ex in tries: | ||
path = shutil.which(ex) | ||
if path: | ||
break | ||
|
||
if not path: | ||
raise Exception(f"Unable to find path to {tries[0]}") | ||
|
||
return path | ||
|
||
|
||
@pytest.fixture | ||
def chrome(): | ||
return executable_path( | ||
"chrome", | ||
"chromium", | ||
"google-chrome-stable", | ||
"chrome.exe", | ||
r"C:\Program Files\Google\Chrome\Application\chrome.exe", | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def chromedriver(): | ||
return executable_path("chromedriver", "chromedriver.exe") | ||
|
||
|
||
@pytest.fixture | ||
def tor(): | ||
return executable_path("tor", "Tor/tor.exe") | ||
|
||
|
||
@pytest.fixture | ||
def browser(chrome, chromedriver): | ||
return Browser(chrome=chrome, chromedriver=chromedriver) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters