This commit is contained in:
Jun-te Kim 2025-03-28 11:01:03 +00:00
parent 0dc8d6bd93
commit f45e7240b2
2 changed files with 63 additions and 0 deletions

42
.github/workflows/pytest.yml vendored Normal file
View file

@ -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' }}

View file

@ -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"