new test framework #1

Merged
dan merged 47 commits from wip-new-framework into dev 2023-11-22 21:40:14 +01:00
Showing only changes of commit 9207d88176 - Show all commits

View file

@ -1,3 +1,4 @@
from datetime import datetime
from pathlib import Path
import pytest
@ -12,9 +13,35 @@ def pytest_addoption(parser):
@pytest.fixture
def config(request):
def dotenv_config(request) -> dict[str, str]:
dotenv_path = request.config.getoption("--env_file_path")
dotenv_path = Path(dotenv_path)
assert dotenv_path.is_file()
config = dotenv_values(dotenv_path)
return config
return dotenv_values(dotenv_path)
@pytest.fixture(scope="session", autouse=True)
def session_id() -> str:
current_datetime = datetime.now()
return current_datetime.strftime("%Y-%m-%d-%H-%M")
@pytest.fixture(scope="session", autouse=True)
def TEST_DIR(session_id) -> Path:
all_tests_dir = Path("tests")
all_tests_dir.mkdir(exist_ok=True)
test_dir = all_tests_dir / Path(f"test_{session_id}")
test_dir.mkdir()
return test_dir
@pytest.fixture(scope="session", autouse=True)
def RECORDS(TEST_DIR) -> Path:
records = TEST_DIR / Path("records")
return records.mkdir()
@pytest.fixture(scope="session", autouse=True)
def STATES(TEST_DIR) -> Path:
states = TEST_DIR / Path("states")
return states.mkdir()