add configuration for pytest

This commit is contained in:
mfaisyal
2022-09-23 19:25:32 +07:00
parent fc3b710470
commit 2ccaf87649
5 changed files with 102 additions and 0 deletions

42
tests/conftest.py Normal file
View File

@@ -0,0 +1,42 @@
import importlib
import sys
from pytest import fixture
from opendbm import FacialActivity, Movement, Speech, VerbalAcoustics
# sys.path.append("")
# Movement = importlib.import_module("api_lib.movement")
# Speech = importlib.import_module("api_lib.speech")
# Facial = importlib.import_module("api_lib.facial_activity")
# Verbal_acoustics = importlib.import_module("api_lib.verbal_acoustics")
class Model:
def __init__(self, movement, speech, facial, verbal_acoustics):
self._movement = movement
self._speech = speech
self._facial = facial
self._verbal_acoustics = verbal_acoustics
@property
def movement(self):
return self._movement()
@property
def speech(self):
return self._speech()
@property
def facial(self):
return self._facial()
@property
def verbal_acoustics(self):
return self._verbal_acoustics()
@fixture(scope="session")
def get_model():
m = Model(Movement, Speech, FacialActivity, VerbalAcoustics)
return m

11
tests/facial/conftest.py Normal file
View File

@@ -0,0 +1,11 @@
from pytest import fixture
path1 = "tests/test_data/facial_speech_verbal_video_test.mp4"
@fixture(scope="class")
def processing_facial_activity(get_model):
m = get_model.facial
m.fit(path1)
yield m

View File

@@ -0,0 +1,11 @@
from pytest import fixture
path1 = "tests/test_data/movement_video_test.mp4"
@fixture(scope="class")
def processing_movement(get_model):
m = get_model.movement
m.fit(path1)
yield m

19
tests/speech/conftest.py Normal file
View File

@@ -0,0 +1,19 @@
from pytest import fixture
test_path = "tests/test_data/"
path_mp4 = test_path + "facial_speech_verbal_video_test.mp4"
path_wav = test_path + "facial_speech_verbal_audio_test.wav"
@fixture(scope="class")
def processing_speech_mp4(get_model):
m = get_model.speech
m.fit(path_mp4)
yield m
@fixture(scope="class")
def processing_speech_wav(get_model):
m = get_model.speech
m.fit(path_wav)
yield m

View File

@@ -0,0 +1,19 @@
from pytest import fixture
test_path = "tests/test_data/"
path_mp4 = test_path + "facial_speech_verbal_video_test.mp4"
path_wav = test_path + "facial_speech_verbal_audio_test.wav"
@fixture(scope="class")
def processing_verbal_acoustics_mp4(get_model):
m = get_model.verbal_acoustics
m.fit(path_mp4)
yield m
@fixture(scope="class")
def processing_verbal_acoustics_wav(get_model):
m = get_model.verbal_acoustics
m.fit(path_wav)
yield m