Skip to content

Commit 26a1202

Browse files
committed
test: add verbose ffmpeg messages on error and in verbose mode
errors from ffmpeg were being captured but not printed, so I could not see what they were. In case or error or in verbose mode, let's see them.
1 parent 509811b commit 26a1202

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

aligner/tests/test_cli.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from ..classes import Segment
2323
from ..cli import app
2424

25+
VERBOSE_OVERRIDE = bool(os.environ.get("EVERYVOICE_VERBOSE_TESTS", False))
26+
2527

2628
class CLITest(TestCase):
2729
def setUp(self) -> None:
@@ -83,8 +85,12 @@ def test_align_something(self):
8385
wav = tmppath / "ej-fra.wav"
8486
# Under most circumstances, align can take a .m4a input file, but not
8587
# in CI. It's not a hard requirement, so just convert to .wav.
86-
subprocess.run(["ffmpeg", "-i", m4a, wav], capture_output=True)
87-
# os.system("ls -la " + tmpdir)
88+
result = subprocess.run(["ffmpeg", "-i", m4a, wav], capture_output=True)
89+
if result.returncode != 0 or VERBOSE_OVERRIDE:
90+
print("ffmpeg output:", result.stdout, result.stderr)
91+
print("ffmpeg exit code:", result.returncode)
92+
print(tmpdir)
93+
os.system("ls -la " + tmpdir)
8894
textgrid = tmppath / "ej-fra-16000.TextGrid"
8995
wav_out = tmppath / "ej-fra-16000.wav"
9096

0 commit comments

Comments
 (0)