chore: Add pytest configuration and update CI to skip DeepFace during tests
CI / skip-ci-check (push) Successful in 1m27s
CI / lint-and-type-check (push) Has been cancelled
CI / python-lint (push) Has been cancelled
CI / test-backend (push) Has been cancelled
CI / build (push) Has been cancelled
CI / secret-scanning (push) Has been cancelled
CI / dependency-scan (push) Has been cancelled
CI / sast-scan (push) Has been cancelled
CI / workflow-summary (push) Has been cancelled
CI / skip-ci-check (pull_request) Successful in 1m27s
CI / lint-and-type-check (pull_request) Successful in 2m6s
CI / python-lint (pull_request) Successful in 1m54s
CI / test-backend (pull_request) Successful in 3m39s
CI / build (pull_request) Successful in 2m24s
CI / secret-scanning (pull_request) Successful in 1m40s
CI / dependency-scan (pull_request) Successful in 1m33s
CI / sast-scan (pull_request) Successful in 2m47s
CI / workflow-summary (pull_request) Successful in 1m26s
CI / skip-ci-check (push) Successful in 1m27s
CI / lint-and-type-check (push) Has been cancelled
CI / python-lint (push) Has been cancelled
CI / test-backend (push) Has been cancelled
CI / build (push) Has been cancelled
CI / secret-scanning (push) Has been cancelled
CI / dependency-scan (push) Has been cancelled
CI / sast-scan (push) Has been cancelled
CI / workflow-summary (push) Has been cancelled
CI / skip-ci-check (pull_request) Successful in 1m27s
CI / lint-and-type-check (pull_request) Successful in 2m6s
CI / python-lint (pull_request) Successful in 1m54s
CI / test-backend (pull_request) Successful in 3m39s
CI / build (pull_request) Successful in 2m24s
CI / secret-scanning (pull_request) Successful in 1m40s
CI / dependency-scan (pull_request) Successful in 1m33s
CI / sast-scan (pull_request) Successful in 2m47s
CI / workflow-summary (pull_request) Successful in 1m26s
This commit introduces a new `pytest.ini` configuration file for backend tests, specifying test discovery patterns and output options. Additionally, the CI workflow is updated to set an environment variable that prevents DeepFace and TensorFlow from loading during tests, avoiding illegal instruction errors on certain CPUs. The face service and pose detection modules are modified to conditionally import DeepFace and RetinaFace based on this environment variable, enhancing test reliability. These changes improve the testing setup and contribute to a more robust CI process.
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
"""Face pose detection (yaw, pitch, roll) using RetinaFace landmarks"""
|
||||
|
||||
import os
|
||||
import numpy as np
|
||||
from math import atan2, degrees
|
||||
from typing import Dict, Tuple, Optional, List
|
||||
|
||||
try:
|
||||
from retinaface import RetinaFace
|
||||
RETINAFACE_AVAILABLE = True
|
||||
except ImportError:
|
||||
# Skip RetinaFace import during tests to avoid illegal instruction errors
|
||||
if os.getenv("SKIP_DEEPFACE_IN_TESTS") == "1":
|
||||
RETINAFACE_AVAILABLE = False
|
||||
RetinaFace = None
|
||||
else:
|
||||
try:
|
||||
from retinaface import RetinaFace
|
||||
RETINAFACE_AVAILABLE = True
|
||||
except ImportError:
|
||||
RETINAFACE_AVAILABLE = False
|
||||
RetinaFace = None
|
||||
|
||||
|
||||
class PoseDetector:
|
||||
|
||||
Reference in New Issue
Block a user