diff options
| author | tassaron | 2022-05-09 22:34:28 -0400 |
|---|---|---|
| committer | tassaron | 2022-05-09 22:34:28 -0400 |
| commit | 07b847e363263221ceb04f8519f45572eda6c5bc (patch) | |
| tree | 9c200eb013cfba55ef0a5eaf0370a7813db38d84 | |
| parent | aee06dcbdad4021e3e1a26bfba731e1efc710e64 (diff) | |
use pytest-qt to test actual export process
| -rw-r--r-- | src/__init__.py | 2 | ||||
| -rw-r--r-- | src/tests/test_commandline_export.py | 30 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/__init__.py b/src/__init__.py index d2e783b..2080de5 100644 --- a/src/__init__.py +++ b/src/__init__.py | |||
| @@ -3,7 +3,7 @@ import os | |||
| 3 | import logging | 3 | import logging |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | __version__ = '2.0.0-b2' | 6 | __version__ = '2.0.0' |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | class Logger(logging.getLoggerClass()): | 9 | class Logger(logging.getLoggerClass()): |
diff --git a/src/tests/test_commandline_export.py b/src/tests/test_commandline_export.py new file mode 100644 index 0000000..62db3b6 --- /dev/null +++ b/src/tests/test_commandline_export.py | |||
| @@ -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 | ||
