aboutsummaryrefslogtreecommitdiff
path: root/tests/test_toolkit_common.py
diff options
context:
space:
mode:
authorBrianna Rainey2026-01-29 14:50:29 -0500
committerGitHub2026-01-29 14:50:29 -0500
commit71a22c6a121d1294a05ef35020c525fa70cae2fd (patch)
tree025dd2329c214a5fe5ac78c7f2e8342e2bfde14d /tests/test_toolkit_common.py
parentf66eb99465c61232a7f649e66bee59504bb0e52c (diff)
v2.2.2 - fix flaky tests, fix UnboundLocalError in MainWindow.createNewProject (#94)
* search more than one filename for compName * remove extra QVBoxLayout * insert default components using name instead of index * bump version 2.2.1 to 2.2.2 * tests do not use `.config` for settings Core.storeSettings() is no longer called as a side effect any time avp.core is imported. Thus the tests use a new `initCore` method and the normal user path now relies on entering via `cli.py`. This means certain toolkit functions (e.g., ones using `FFMPEG_BIN`) no longer work if imported from a different python script, unless they call Core.storeSettings() themselves to initialize the settings.ini file * fix UnboundLocalError in createNewProject
Diffstat (limited to 'tests/test_toolkit_common.py')
-rw-r--r--tests/test_toolkit_common.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/test_toolkit_common.py b/tests/test_toolkit_common.py
index 8e9dca2..b20ae53 100644
--- a/tests/test_toolkit_common.py
+++ b/tests/test_toolkit_common.py
@@ -2,20 +2,25 @@ from pytest import fixture
from pytestqt import qtbot
from avp.command import Command
from avp.toolkit import blockSignals, rgbFromString
+from . import command
@fixture
def gotWarning():
"""Check if a function called log.warning"""
import avp.toolkit.common as tk
+
warning = False
+
def gotWarning():
nonlocal warning
return warning
+
class log:
def warning(self, *args):
nonlocal warning
warning = True
+
oldLog = tk.log
tk.log = log()
try:
@@ -24,8 +29,7 @@ def gotWarning():
tk.log = oldLog
-def test_blockSignals(qtbot):
- command = Command()
+def test_blockSignals(qtbot, command):
command.core.insertComponent(0, 0, command)
comp = command.core.selectedComponents[0]
assert comp.page.spinBox_scale.signalsBlocked() == False
@@ -41,4 +45,4 @@ def test_rgbFromString(gotWarning):
def test_rgbFromString_error(gotWarning):
assert rgbFromString("255,255,256") == (255, 255, 255)
- assert gotWarning() \ No newline at end of file
+ assert gotWarning()