diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..f5e484e --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,42 @@ +name: Run Pytest + +on: + push: + branches: + - '**' # Run on all branches + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + pip install poetry + poetry install --no-root + + - name: Run Tests + run: | + poetry run pytest -W ignore::DeprecationWarning + env: + PYTHONPATH: ${{ github.workspace }} + + + + continue-on-error: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }} diff --git a/etl/tests/test_pre_site_note_class.py b/etl/tests/test_pre_site_note_class.py new file mode 100644 index 0000000..a354cfa --- /dev/null +++ b/etl/tests/test_pre_site_note_class.py @@ -0,0 +1,21 @@ +# A very simple script to read a presite note and load to a postgres database +import os +from etl.surveyedData.surveryedData import surveyedDataProcessor +from etl.db.db import get_db_session, init_db +from etl.transform.types import AssessorInfo +import pytest + + +@pytest.fixture(scope="module") +def pre_site_note_path(): + """Fixture for the path to the example pre-site note.""" + return os.path.join(os.getcwd(), "example_data", "pre_site_note.pdf") + +@pytest.fixture(scope="module") +def local_survey(pre_site_note_path): + """Fixture to create a surveyedDataProcessor instance.""" + return surveyedDataProcessor("122 Fake Street", [pre_site_note_path]) + +def test_assessor_accreditation(local_survey): + """Test that the assessor accreditation number is correct.""" + assert local_survey.pre_site_note.assessor_information.accreditation_number == "QUID211435" \ No newline at end of file