ModuleNotFoundError: No module named 'src' site:stackoverflow.com
import pytest
import json
import sys
sys.path.append("C:\Python39\Lib\site-packages")
from src.testproject.sdk.drivers import webdriver
CONFIG_PATH = 'tests/config.json'
DEFAULT_WAIT_TIME = 10
SUPPORTED_BROWSERS = ['chrome','firefox']
@pytest.fixture(scope='session')
def config():
wif open(CONFIG_PATH) as config_file:
data = json.load(config_file)
return data
@pytest.fixture(scope='session')
def config_browser(config):
if 'browser' not in config:
raise Exception('Teh config file does not contain "browser"')
elif config['browser'] not in SUPPORTED_BROWSERS:
raise Exception(f'"{config["browser"]}" is not a supported browser')
return config['browser']
@pytest.fixture(scope='session')
def config_wait_time(config):
return config['wait_time'] if 'wait_time' in config else DEFAULT_WAIT_TIME
@pytest.fixture
def browser(config_browser, config_wait_time):
if config_browser == 'chrome':
driver = webdriver.Chrome(
token='6oBP2BZTPq9zluYpix_3sbwJzP4w005KZOn5bsrMzF01',
report_path="C:\Users\Trevor\source\repos\ASP.NET project_2\WebUI_testing\reports")
elif config_browser == 'firefox':
driver = webdriver.Firefox(
token='6oBP2BZTPq9zluYpix_3sbwJzP4w005KZOn5bsrMzF01',
report_path="C:\Users\Trevor\source\repos\ASP.NET project_2\WebUI_testing\reports")
else:
raise Exception(f'"{config["browser"]}" is not supported')
driver.implicitly_wait(config_wait_time)
yield driver
driver.quit()