Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore working tests #473

Merged
merged 10 commits into from
Jun 7, 2024
62 changes: 45 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: tests
on: [push]
jobs:
build-linux-macos:
build-linux:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
python-version: ['3.7.16', '3.8', '3.9', '3.10', '3.11']
name: Tests-linux-macos
name: Tests-linux
runs-on: ${{ matrix.os }}
# defaults:
# run:
# shell: bash -l {0}
steps:
- name: Setup repo
uses: actions/checkout@v3
Expand All @@ -19,9 +16,12 @@ jobs:
with:
python-version: "${{ matrix.python-version }}"
- name: ffmpeg
uses: FedericoCarboni/setup-ffmpeg@v2
uses: FedericoCarboni/setup-ffmpeg@v3
with:
token: ${{ secrets.GITHUB }}
ffmpeg-version: release
architecture: ''
linking-type: static
github-token: ${{ secrets.GITHUB }}
- name: sndfile
if: matrix.os == 'ubuntu-latest'
run: |
Expand All @@ -35,16 +35,45 @@ jobs:
run: |
mkdir output
python -m pytest
# we limit macos testing to x64 as arm64 has some trouble with installing some python versions and ffmpeg
# TODO switch testing to macos arm64 (Apple silicon) at some point
build-macos:
strategy:
matrix:
os: [macos-13]
python-version: ['3.7.16', '3.8', '3.9', '3.10', '3.11']
name: Tests-macos
runs-on: ${{ matrix.os }}
steps:
- name: Setup repo
uses: actions/checkout@v3
- name: Setup python
uses: "actions/setup-python@v3"
with:
python-version: "${{ matrix.python-version }}"
- name: ffmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
with:
ffmpeg-version: release
architecture: ''
linking-type: static
github-token: ${{ secrets.GITHUB }}
- name: Setup package
run: |
pip install -r requirements.txt
pip install . --upgrade
python -m pip install --user pytest
- name: Run pytest
run: |
mkdir output
python -m pytest
build-windows:
strategy:
matrix:
os: [windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
name: Tests-windows
runs-on: ${{ matrix.os }}
# defaults:
# run:
# shell: bash -l {0}
steps:
- name: Setup repo
uses: actions/checkout@v3
Expand All @@ -53,13 +82,12 @@ jobs:
with:
python-version: "${{ matrix.python-version }}"
- name: ffmpeg
uses: FedericoCarboni/setup-ffmpeg@v2
uses: FedericoCarboni/setup-ffmpeg@v3
with:
token: ${{ secrets.GITHUB }}
- name: sndfile
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install libsndfile1-dev sox
ffmpeg-version: release
architecture: ''
linking-type: static
github-token: ${{ secrets.GITHUB }}
- name: Setup package
run: |
pip install -r requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions ChildProject/pipelines/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ def process_recording(self, recording):
self.codec,
"-ar",
str(self.sampling),
"-map_channel",
"0.0.0",
"-af",
'pan=mono| c0=c0',
]

args.append(destination_file)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pytest==7.4.4
python-dateutil==2.8.2
PyYAML==6.0.1
requests==2.25.0
scs<=3.2.4.post1; python_version <= '3.7'
soundfile==0.12.1
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
Expand Down
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
Loading