Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,44 @@ run-name: ${{ github.actor }} is building symmetry 🚀
on: [push]
jobs:
Test_API_endpoints:
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11.8'
python-version: '3.13'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd fastapi/
cd backend-fastapi/
pip install -r requirements.txt
python -m nltk.downloader punkt
echo "=== Installed packages ==="
pip list
echo "=== Current directory ==="
pwd
echo "=== Python path ==="
python -c "import sys; print('\n'.join(sys.path))"
echo "=== Checking pytest installation ==="
python -c "import pytest; print('pytest version:', pytest.__version__)"

- name: Run Pytest
run: python -m pytest
run: |
echo "=== Running pytest from backend-fastapi directory ==="
cd backend-fastapi/
python -m pytest

- name: Install PyInstaller
run: pip install pyinstaller

- name: Build with PyInstaller
run: pyinstaller -F api/flaskr/pyapp.py

run: |
echo "=== Running PyInstaller from backend-fastapi directory ==="
cd backend-fastapi/app/
pyinstaller -F main.py

- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions fastapi/app/main.py → backend-fastapi/app/main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#!/bin/bash
import argparse
import logging
import re
import requests
from traceback import format_exc

from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from fastapi import Query
from pydantic import BaseModel
from starlette.config import Config
from starlette.requests import Request
from starlette.responses import JSONResponse
import uvicorn
import wikipediaapi
from typing import List

from app.api import wiki_article
from app.api import comparison
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions backend-fastapi/app/test/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pytest
from app.main import app

def test_app_exists():
"""Test that the FastAPI app can be imported"""
assert app is not None

def test_app_has_title():
"""Test that the app has a title"""
assert app.title is not None
assert len(app.title) > 0

def test_app_has_version():
"""Test that the app has a version"""
assert app.version is not None
assert len(app.version) > 0
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions backend-fastapi/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[tool.pytest.ini_options]
filterwarnings = [
"ignore::DeprecationWarning:click.parser",
"ignore::DeprecationWarning:weasel.util.config",
"ignore::DeprecationWarning:spacy.cli._util"
]
5 changes: 5 additions & 0 deletions backend-fastapi/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[tool:pytest]
filterwarnings =
ignore::DeprecationWarning:click.parser
ignore::DeprecationWarning:weasel.util.config
ignore::DeprecationWarning:spacy.cli._util
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ ollama
transformers
nltk
uvicorn
Wikipedia-API
Wikipedia-API
pytest
26 changes: 0 additions & 26 deletions fastapi/app/test/test_main.py

This file was deleted.