Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10']
pyqt-version: [5.12.3, 5.15.9]
os: [windows-latest]
python-version: ['3.10']
pyqt-version: [5.15.9]
env:
DISPLAY: ':99.0'
QT_MAC_WANTS_LAYER: 1 # PyQT gui tests involving qtbot interaction on macOS will fail without this
Expand Down Expand Up @@ -72,6 +72,6 @@ jobs:

- name: Test with pytest
shell: bash -el {0}
timeout-minutes: 30 # timeout applies to single run of run_tests.py, not all os/python combos
timeout-minutes: 50 # timeout applies to single run of run_tests.py, not all os/python combos
run: |
python run_tests.py
python run_tests.py -s
24 changes: 24 additions & 0 deletions pydm/tests/widgets/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,31 +230,55 @@ def test_rules_invalid_expr(qtbot, caplog):
}
]

print("! 1")
dispatcher = RulesDispatcher()
print("! 2")
dispatcher.register(widget, rules)
print("! 3")

re = dispatcher.rules_engine
print("! 3")

assert weakref.ref(widget) in re.widget_map
print("! 4")

assert len(re.widget_map[weakref.ref(widget)]) == 1
print("! 5")

assert re.widget_map[weakref.ref(widget)][0]["rule"] == rules[0]
print("! 6")

caplog.clear()
print("! 7")

rules[0]["expression"] = "foo"
print("! 8")

dispatcher.register(widget, rules)
print("! 9")

assert len(re.widget_map[weakref.ref(widget)]) == 1
print("! 10")

re.callback_conn(weakref.ref(widget), 0, 0, value=True)
print("! 11")

re.callback_value(weakref.ref(widget), 0, 0, trigger=True, value="a")
print("! 12")

# Wait for rule to execute but keep app responsive
qtbot.wait(5000)
print("! 13")

for record in caplog.records:
assert record.levelno == logging.ERROR
assert "Error while evaluating Rule" in caplog.text

print("! 14")

dispatcher.unregister(widget)
assert weakref.ref(widget) not in re.widget_map
print("! 15")


def test_rules_initial_value(qtbot, caplog):
Expand Down