fix and add som usecases
This commit is contained in:
20
conftest.py
Normal file
20
conftest.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def env_config():
|
||||
# A fixture to read the config file once per session.
|
||||
# In a real-world scenario, you might add logic here to select
|
||||
# different config files (e.g., dev, prod) based on a command-line argument.
|
||||
with open('config/dev_env.yaml', 'r') as file:
|
||||
return yaml.safe_load(file)
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def base_url(env_config):
|
||||
"""
|
||||
Provides the base URL for the application under test.
|
||||
"""
|
||||
url = env_config.get('base_url')
|
||||
if not url:
|
||||
raise Exception("'base_url' not found in config file.")
|
||||
return url
|
||||
Reference in New Issue
Block a user