From 2ccaf87649ad1b360f1e5aeda41aece911b51b21 Mon Sep 17 00:00:00 2001 From: mfaisyal Date: Fri, 23 Sep 2022 19:25:32 +0700 Subject: [PATCH] add configuration for pytest --- tests/conftest.py | 42 ++++++++++++++++++++++++++++++ tests/facial/conftest.py | 11 ++++++++ tests/movement/conftest.py | 11 ++++++++ tests/speech/conftest.py | 19 ++++++++++++++ tests/verbal_acoustics/conftest.py | 19 ++++++++++++++ 5 files changed, 102 insertions(+) create mode 100644 tests/conftest.py create mode 100644 tests/facial/conftest.py create mode 100644 tests/movement/conftest.py create mode 100644 tests/speech/conftest.py create mode 100644 tests/verbal_acoustics/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..cacfb1c1 --- /dev/null +++ b/tests/conftest.py @@ -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 diff --git a/tests/facial/conftest.py b/tests/facial/conftest.py new file mode 100644 index 00000000..a87343fb --- /dev/null +++ b/tests/facial/conftest.py @@ -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 diff --git a/tests/movement/conftest.py b/tests/movement/conftest.py new file mode 100644 index 00000000..8a91a346 --- /dev/null +++ b/tests/movement/conftest.py @@ -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 diff --git a/tests/speech/conftest.py b/tests/speech/conftest.py new file mode 100644 index 00000000..84c96343 --- /dev/null +++ b/tests/speech/conftest.py @@ -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 diff --git a/tests/verbal_acoustics/conftest.py b/tests/verbal_acoustics/conftest.py new file mode 100644 index 00000000..2ce06572 --- /dev/null +++ b/tests/verbal_acoustics/conftest.py @@ -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