CI: Run Python tests (#1001)

This commit is contained in:
Itay 2024-01-28 22:59:51 +02:00 committed by GitHub
parent 35105f951b
commit 0ce992e22e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 1 deletions

35
.github/workflows/pr-python-tests.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Python Unit Tests
on:
pull_request:
branches: [ main ]
jobs:
backend-check:
runs-on: ubuntu-latest
env:
PYTHONPATH: ./backend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
backend/requirements/default.txt
backend/requirements/dev.txt
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements/default.txt
pip install -r backend/requirements/dev.txt
- name: Run Tests
shell: script -q -e -c "bash --noprofile --norc -eo pipefail {0}"
run: py.test -o junit_family=xunit2 -xv --ff backend/tests/unit

View File

@ -1,3 +1,4 @@
import pathlib
import unittest
from danswer.connectors.cross_connector_utils.html_utils import parse_html_page_basic
@ -5,7 +6,8 @@ from danswer.connectors.cross_connector_utils.html_utils import parse_html_page_
class TestQAPostprocessing(unittest.TestCase):
def test_parse_table(self) -> None:
with open("./test_table.html", "r") as file:
dir_path = pathlib.Path(__file__).parent.resolve()
with open(f"{dir_path}/test_table.html", "r") as file:
content = file.read()
parsed = parse_html_page_basic(content)