From 5016b6b870f2378b35f81cac0d67e0f0fc9fa5ed Mon Sep 17 00:00:00 2001 From: SoYan500 Date: Fri, 23 May 2025 23:09:50 +0000 Subject: [PATCH 1/5] Start draft PR From 1f467d6a066419b7a47f39d8e5ee58fc879b5d16 Mon Sep 17 00:00:00 2001 From: SoYan500 Date: Fri, 23 May 2025 23:10:16 +0000 Subject: [PATCH 2/5] Add pytest configuration with coverage and test discovery settings --- pytest.ini | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 pytest.ini 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 From 4526a397c11cdff1b435227be6580c2f3a3f0ff0 Mon Sep 17 00:00:00 2001 From: SoYan500 Date: Fri, 23 May 2025 23:10:22 +0000 Subject: [PATCH 3/5] Add conftest.py with project configuration and fixtures --- tests/conftest.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/conftest.py 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 From adb5ecbf93a45c5adc38c4e75a4b472962d4e6e5 Mon Sep 17 00:00:00 2001 From: SoYan500 Date: Fri, 23 May 2025 23:10:29 +0000 Subject: [PATCH 4/5] Add basic configuration test to verify pytest setup --- tests/test_basic_config.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/test_basic_config.py 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 From cb7bf985f546842042ec24e19012dea73b327dd8 Mon Sep 17 00:00:00 2001 From: SoYan500 Date: Fri, 23 May 2025 23:10:41 +0000 Subject: [PATCH 5/5] Add pytest and pytest-cov to requirements.txt --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) 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