diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 5c66d6a..aa7c3c3 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,6 +1,6 @@ name: Pylint -on: [push] +on: [pull_request] jobs: build: diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 39ccdb5..f3d4fca 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -28,11 +28,6 @@ jobs: python -m pip install --upgrade pip pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Start FastAPI server - run: | - uvicorn main:app --reload & - sleep 10 # Give FastAPI some time to start - shell: bash - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names diff --git a/main/__init__.py b/main/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main/main.py similarity index 100% rename from main.py rename to main/main.py diff --git a/testing/__init__.py b/testing/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/testing/test_register_face.py b/testing/test_register_face.py index 283bb8b..2bdf38d 100644 --- a/testing/test_register_face.py +++ b/testing/test_register_face.py @@ -1,14 +1,14 @@ import pytest import requests from fastapi.testclient import TestClient -from main import app +from main.main import app import os client = TestClient(app) def test_register_face(): # Open a test image file in binary mode IMAGEDIR = "test-faces/" - with open("test-faces/07c64ef1-b32e-4396-97ea-0894249d58ee.jpg", "rb") as image_file: + with open(".\\test-faces\\07c64ef1-b32e-4396-97ea-0894249d58ee.jpg", "rb") as image_file: # Create a tuple with the file's name and its content file_tuple = ("test_image.jpg", image_file.read()) # Create a dictionary with the file's data