aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/__init__.py14
-rw-r--r--src/tests/test_commandline_export.py17
-rw-r--r--src/tests/test_commandline_parser.py11
-rw-r--r--src/tests/test_core_init.py16
4 files changed, 35 insertions, 23 deletions
diff --git a/src/tests/__init__.py b/src/tests/__init__.py
index 345bd96..e2d83e7 100644
--- a/src/tests/__init__.py
+++ b/src/tests/__init__.py
@@ -5,20 +5,22 @@ from ..core import Core
def getTestDataPath(filename):
- return os.path.join(Core.wd, 'tests', 'data', filename)
+ return os.path.join(Core.wd, "tests", "data", filename)
def run(logFile):
"""Run Pytest, which then imports and runs all tests in this module."""
- os.environ["PYTEST_QT_API"] = "pyqt5"
+ os.environ["PYTEST_QT_API"] = "PyQt6"
with open(logFile, "w") as f:
# temporarily redirect stdout to a text file so we capture pytest's output
sys.stdout = f
try:
- val = pytest.main([
- os.path.dirname(__file__),
- "-s", # disable pytest's internal capturing of stdout etc.
- ])
+ val = pytest.main(
+ [
+ os.path.dirname(__file__),
+ "-s", # disable pytest's internal capturing of stdout etc.
+ ]
+ )
finally:
sys.stdout = sys.__stdout__
diff --git a/src/tests/test_commandline_export.py b/src/tests/test_commandline_export.py
index 7f3530f..6126da7 100644
--- a/src/tests/test_commandline_export.py
+++ b/src/tests/test_commandline_export.py
@@ -7,11 +7,20 @@ from pytestqt import qtbot
def test_commandline_classic_export(qtbot):
- '''Run Qt event loop and create a video in the system /tmp or /temp'''
+ """Run Qt event loop and create a video in the system /tmp or /temp"""
soundFile = getTestDataPath("test.ogg")
outputDir = tempfile.mkdtemp(prefix="avp-test-")
outputFilename = os.path.join(outputDir, "output.mp4")
- sys.argv = ['', '-c', '0', 'classic', '-i', soundFile, '-o', outputFilename]
+ sys.argv = [
+ "",
+ "-c",
+ "0",
+ "classic",
+ "-i",
+ soundFile,
+ "-o",
+ outputFilename,
+ ]
command = Command()
command.quit = lambda _: None
@@ -19,10 +28,10 @@ def test_commandline_classic_export(qtbot):
# Command object now has a video_thread Worker which is exporting the video
with qtbot.waitSignal(command.worker.videoCreated, timeout=10000):
- '''
+ """
Wait until videoCreated is emitted by the video_thread Worker
or until 10 second timeout has passed
- '''
+ """
print(f"Test Video created at {outputFilename}")
assert os.path.exists(outputFilename)
diff --git a/src/tests/test_commandline_parser.py b/src/tests/test_commandline_parser.py
index 0813e00..5d1232b 100644
--- a/src/tests/test_commandline_parser.py
+++ b/src/tests/test_commandline_parser.py
@@ -5,28 +5,28 @@ from ..command import Command
def test_commandline_help():
command = Command()
- sys.argv = ['', '--help']
+ sys.argv = ["", "--help"]
with pytest.raises(SystemExit):
command.parseArgs()
def test_commandline_help_if_bad_args():
command = Command()
- sys.argv = ['', '--junk']
+ sys.argv = ["", "--junk"]
with pytest.raises(SystemExit):
command.parseArgs()
def test_commandline_launches_gui_if_debug():
command = Command()
- sys.argv = ['', '--debug']
+ sys.argv = ["", "--debug"]
mode = command.parseArgs()
assert mode == "GUI"
def test_commandline_launches_gui_if_debug_with_project():
command = Command()
- sys.argv = ['', 'test', '--debug']
+ sys.argv = ["", "test", "--debug"]
mode = command.parseArgs()
assert mode == "GUI"
@@ -34,11 +34,12 @@ def test_commandline_launches_gui_if_debug_with_project():
def test_commandline_tries_to_export():
command = Command()
didCallFunction = False
+
def captureFunction(*args):
nonlocal didCallFunction
didCallFunction = True
- sys.argv = ['', '-c', '0', 'classic', '-i', '_', '-o', '_']
+ sys.argv = ["", "-c", "0", "classic", "-i", "_", "-o", "_"]
command.createAudioVisualization = captureFunction
command.parseArgs()
assert didCallFunction
diff --git a/src/tests/test_core_init.py b/src/tests/test_core_init.py
index 438f7fe..950dc13 100644
--- a/src/tests/test_core_init.py
+++ b/src/tests/test_core_init.py
@@ -4,15 +4,15 @@ from ..core import Core
def test_component_names():
core = Core()
assert core.compNames == [
- 'Classic Visualizer',
- 'Color',
+ "Classic Visualizer",
+ "Color",
"Conway's Game of Life",
- 'Image',
- 'Sound',
- 'Spectrum',
- 'Title Text',
- 'Video',
- 'Waveform',
+ "Image",
+ "Sound",
+ "Spectrum",
+ "Title Text",
+ "Video",
+ "Waveform",
]