aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/__init__.py15
-rw-r--r--src/tests/test_commandline_parser.py19
-rw-r--r--src/tests/test_core_init.py8
3 files changed, 19 insertions, 23 deletions
diff --git a/src/tests/__init__.py b/src/tests/__init__.py
index 062dca7..345bd96 100644
--- a/src/tests/__init__.py
+++ b/src/tests/__init__.py
@@ -2,26 +2,15 @@ import pytest
import os
import sys
from ..core import Core
-from ..command import Command
-@pytest.fixture
-def core():
- return Core()
-
-
-@pytest.fixture
-def command():
- """Like a MainWindow for commandline mode, this owns the Core"""
- return Command()
-
-
-def getTestData(filename):
+def getTestDataPath(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"
with open(logFile, "w") as f:
# temporarily redirect stdout to a text file so we capture pytest's output
sys.stdout = f
diff --git a/src/tests/test_commandline_parser.py b/src/tests/test_commandline_parser.py
index d672441..0813e00 100644
--- a/src/tests/test_commandline_parser.py
+++ b/src/tests/test_commandline_parser.py
@@ -1,39 +1,44 @@
import sys
import pytest
-from .__init__ import command
+from ..command import Command
-def test_commandline_help(command):
+def test_commandline_help():
+ command = Command()
sys.argv = ['', '--help']
with pytest.raises(SystemExit):
command.parseArgs()
-def test_commandline_help_if_bad_args(command):
+def test_commandline_help_if_bad_args():
+ command = Command()
sys.argv = ['', '--junk']
with pytest.raises(SystemExit):
command.parseArgs()
-def test_commandline_launches_gui_if_debug(command):
+def test_commandline_launches_gui_if_debug():
+ command = Command()
sys.argv = ['', '--debug']
mode = command.parseArgs()
assert mode == "GUI"
-def test_commandline_launches_gui_if_debug_with_project(command):
+def test_commandline_launches_gui_if_debug_with_project():
+ command = Command()
sys.argv = ['', 'test', '--debug']
mode = command.parseArgs()
assert mode == "GUI"
-def test_commandline_export_creates_audio_visualization(command):
+def test_commandline_tries_to_export():
+ command = Command()
didCallFunction = False
def captureFunction(*args):
nonlocal didCallFunction
didCallFunction = True
sys.argv = ['', '-c', '0', 'classic', '-i', '_', '-o', '_']
- command.createAudioVisualisation = captureFunction
+ command.createAudioVisualization = captureFunction
command.parseArgs()
assert didCallFunction
diff --git a/src/tests/test_core_init.py b/src/tests/test_core_init.py
index 696533a..438f7fe 100644
--- a/src/tests/test_core_init.py
+++ b/src/tests/test_core_init.py
@@ -1,7 +1,8 @@
-from .__init__ import core
+from ..core import Core
-def test_component_names(core):
+def test_component_names():
+ core = Core()
assert core.compNames == [
'Classic Visualizer',
'Color',
@@ -15,5 +16,6 @@ def test_component_names(core):
]
-def test_moduleindex(core):
+def test_moduleindex():
+ core = Core()
assert core.moduleIndexFor("Classic Visualizer") == 0