Skip to content

Commit

Permalink
standardize fixtures for process testing
Browse files Browse the repository at this point in the history
  • Loading branch information
LoannPeurey committed Jun 6, 2024
1 parent 2aaa0c3 commit eb15ed0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
import pandas as pd
import pytest
import shutil
from pathlib import Path


PATH = Path('output', 'process')
@pytest.fixture(scope="function")
def project(request):
if not os.path.exists("output/process"):
shutil.copytree(src="examples/valid_raw_data", dst="output/process")
if os.path.exists(PATH):
shutil.rmtree(PATH)
shutil.copytree(src="examples/valid_raw_data", dst=PATH)

project = ChildProject("output/process")
project = ChildProject(PATH)
project.read()

yield project


Expand Down Expand Up @@ -65,7 +68,7 @@ def test_standard(project):
8000, project.compute_recordings_duration()["duration"].sum()
), "audio duration equals expected value"
assert os.path.exists(
os.path.join(project.path, CONVERTED_RECORDINGS, "test")
os.path.join(project.path, CONVERTED_RECORDINGS, "standard")
), "missing processed recordings folder"
assert (
recordings.shape[0] == converted_recordings.shape[0]
Expand All @@ -76,7 +79,7 @@ def test_standard(project):
assert all(
[
os.path.exists(
os.path.join(project.path, CONVERTED_RECORDINGS, "test", f)
os.path.join(project.path, CONVERTED_RECORDINGS, "standard", f)
)
for f in converted_recordings["converted_filename"].tolist()
]
Expand Down

0 comments on commit eb15ed0

Please sign in to comment.