diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..46a2ec7 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,21 @@ +[pytest] +testpaths = tests +python_files = test_*.py +python_classes = Test* +python_functions = test_* +addopts = + --cov=. + --cov-report=term-missing + --cov-report=html + -v + --doctest-modules + --strict-markers + +markers = + unit: marks unit tests + integration: marks integration tests + slow: marks slow tests + +filterwarnings = + ignore::DeprecationWarning + ignore::UserWarning \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index ae5b535..add60fd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -56,3 +56,6 @@ Werkzeug==1.0.1 wrapt==1.12.1 xlrd==1.2.0 XlsxWriter==1.2.8 +# Test dependencies +pytest +pytest-cov \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..8b831f6 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,26 @@ +import os +import sys +import pytest + +# Add project root to Python path +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + +def pytest_configure(config): + """ + Configure pytest settings and add custom markers + """ + config.addinivalue_line( + "markers", + "unit: mark a test as a unit test" + ) + config.addinivalue_line( + "markers", + "integration: mark a test as an integration test" + ) + +@pytest.fixture(scope='session') +def project_root(): + """ + Fixture to provide the project root directory path + """ + return os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) \ No newline at end of file diff --git a/tests/test_basic_config.py b/tests/test_basic_config.py new file mode 100644 index 0000000..8769ae6 --- /dev/null +++ b/tests/test_basic_config.py @@ -0,0 +1,16 @@ +import os +import pytest + +def test_project_structure(project_root): + """ + Verify basic project configuration + """ + assert os.path.exists(project_root), "Project root directory should exist" + assert os.path.exists(os.path.join(project_root, 'app.py')), "Main application file should exist" + +@pytest.mark.unit +def test_pytest_markers(): + """ + Ensure pytest can recognize custom markers + """ + assert True, "Unit marker test should pass" \ No newline at end of file