Skip to content

Commit 07b847e

Browse files
committed
use pytest-qt to test actual export process
1 parent aee06dc commit 07b847e

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44

55

6-
__version__ = '2.0.0-b2'
6+
__version__ = '2.0.0'
77

88

99
class Logger(logging.getLoggerClass()):
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import sys
2+
import os
3+
import tempfile
4+
from ..command import Command
5+
from . import getTestDataPath
6+
from pytestqt import qtbot
7+
8+
9+
def test_commandline_classic_export(qtbot):
10+
'''Run Qt event loop and create a video in the system /tmp or /temp'''
11+
soundFile = getTestDataPath("test.ogg")
12+
outputDir = tempfile.mkdtemp(prefix="avp-test-")
13+
outputFilename = os.path.join(outputDir, "output.mp4")
14+
sys.argv = ['', '-c', '0', 'classic', '-i', soundFile, '-o', outputFilename]
15+
16+
command = Command()
17+
command.quit = lambda _: None
18+
command.parseArgs()
19+
# Command object now has a video_thread Worker which is exporting the video
20+
21+
with qtbot.waitSignal(command.worker.videoCreated, timeout=10000):
22+
'''
23+
Wait until videoCreated is emitted by the video_thread Worker
24+
or until 10 second timeout has passed
25+
'''
26+
sys.__stdout__.write(f"Test Video created at {outputFilename}")
27+
28+
assert os.path.exists(outputFilename)
29+
# output video should be at least 200kb
30+
assert os.path.getsize(outputFilename) > 200000

0 commit comments

Comments
 (0)