feat: Add coverage, iniconfig, pluggy, pygments, pytest, pytest-cov, and pytest-mock as dependencies
- Added coverage version 7.10.1 with multiple wheel distributions. - Added iniconfig version 2.1.0 with its wheel distribution. - Added pluggy version 1.6.0 with its wheel distribution. - Added pygments version 2.19.2 with its wheel distribution. - Added pytest version 8.4.1 with its wheel distribution and dependencies. - Added pytest-cov version 6.2.1 with its wheel distribution and dependencies. - Added pytest-mock version 3.14.1 with its wheel distribution and dependencies. - Updated dev-dependencies to include coverage, pytest, pytest-cov, and pytest-mock. - Updated requires-dist to specify minimum versions for coverage, pytest, pytest-cov, and pytest-mock.
This commit is contained in:
68
tests/conftest.py
Normal file
68
tests/conftest.py
Normal file
@@ -0,0 +1,68 @@
|
||||
"""
|
||||
Fixtures and configuration for pytest tests.
|
||||
"""
|
||||
import os
|
||||
import tempfile
|
||||
import pytest
|
||||
import pandas as pd
|
||||
from unittest.mock import Mock
|
||||
import logging
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temp_csv_file():
|
||||
"""Create a temporary CSV file for testing."""
|
||||
fd, path = tempfile.mkstemp(suffix='.csv')
|
||||
os.close(fd)
|
||||
yield path
|
||||
# Cleanup
|
||||
if os.path.exists(path):
|
||||
os.unlink(path)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_data():
|
||||
"""Sample data for testing."""
|
||||
return [
|
||||
["2024-01-01", 3, 2, 4, 3, 1, 0, 2, 1, "Test note 1"],
|
||||
["2024-01-02", 2, 3, 3, 4, 1, 1, 2, 0, "Test note 2"],
|
||||
["2024-01-03", 4, 1, 5, 2, 0, 0, 1, 1, ""],
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_dataframe():
|
||||
"""Sample DataFrame for testing."""
|
||||
return pd.DataFrame({
|
||||
'date': ['2024-01-01', '2024-01-02', '2024-01-03'],
|
||||
'depression': [3, 2, 4],
|
||||
'anxiety': [2, 3, 1],
|
||||
'sleep': [4, 3, 5],
|
||||
'appetite': [3, 4, 2],
|
||||
'bupropion': [1, 1, 0],
|
||||
'hydroxyzine': [0, 1, 0],
|
||||
'gabapentin': [2, 2, 1],
|
||||
'propranolol': [1, 0, 1],
|
||||
'note': ['Test note 1', 'Test note 2', '']
|
||||
})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_logger():
|
||||
"""Mock logger for testing."""
|
||||
return Mock(spec=logging.Logger)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temp_log_dir():
|
||||
"""Create a temporary directory for log files."""
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
yield temp_dir
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_env_vars(monkeypatch):
|
||||
"""Mock environment variables."""
|
||||
monkeypatch.setenv("LOG_LEVEL", "DEBUG")
|
||||
monkeypatch.setenv("LOG_PATH", "/tmp/test_logs")
|
||||
monkeypatch.setenv("LOG_CLEAR", "False")
|
||||
Reference in New Issue
Block a user