Add test for launching corrscope with master audio disabled

pull/357/head
nyanpasu64 2019-01-13 03:36:44 -08:00
rodzic 55e55ed585
commit 1f727ce53d
3 zmienionych plików z 32 dodań i 4 usunięć

Wyświetl plik

@ -1,3 +1,9 @@
"""
Integration tests found in:
- test_cli.py
- test_output.py
"""
import os
import subprocess
from typing import TYPE_CHECKING

Wyświetl plik

@ -1,3 +1,7 @@
"""
- Test command-line parsing and Config generation.
- Integration tests (see conftest.py).
"""
import shlex
from os.path import abspath
from pathlib import Path
@ -11,8 +15,8 @@ import corrscope.channel
from corrscope import cli
from corrscope.cli import YAML_NAME
from corrscope.config import yaml
from corrscope.corrscope import Arguments, Config, CorrScope
from corrscope.outputs import FFmpegOutputConfig
from corrscope.corrscope import Config, CorrScope, Arguments
from corrscope.util import pushd
if TYPE_CHECKING:
@ -105,6 +109,9 @@ def test_write_dir(mocker):
assert outpath.parent / cfg.master_audio == audio_path
# Integration tests
@pytest.mark.usefixtures("Popen")
def test_load_yaml_another_dir(mocker, Popen):
""" YAML file located in `another/dir` should resolve `master_audio`, `channels[].
@ -142,6 +149,3 @@ def test_load_yaml_another_dir(mocker, Popen):
argv = args[0]
assert argv[-1] == mp4_abs
assert f"-i {wav_abs}" in " ".join(argv)
# TODO integration test without --audio

Wyświetl plik

@ -208,3 +208,21 @@ def test_render_subfps_non_integer(mocker: "pytest_mock.MockFixture"):
class DummyException(Exception):
pass
# Moved to test_output.py from test_cli.py.
# Because test depends on ffmpeg (not available in Appveyor CI),
# and only test_output.py (not test_cli.py) is skipped in Appveyor.
def test_no_audio(mocker):
""" Corrscope Config without master audio should work. """
subdir = "tests"
wav = "sine440.wav"
channels = [ChannelConfig(wav)]
cfg = default_config(master_audio=None, channels=channels, begin_time=100)
# begin_time=100 skips all actual rendering.
output = FFmpegOutputConfig(None)
corr = CorrScope(cfg, Arguments(subdir, [output]))
corr.play()