mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
add test
This commit is contained in:
parent
0dc8d6bd93
commit
f45e7240b2
2 changed files with 63 additions and 0 deletions
42
.github/workflows/pytest.yml
vendored
Normal file
42
.github/workflows/pytest.yml
vendored
Normal 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' }}
|
||||
21
etl/tests/test_pre_site_note_class.py
Normal file
21
etl/tests/test_pre_site_note_class.py
Normal 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"
|
||||
Loading…
Add table
Reference in a new issue