Skip to content

Commit

Permalink
Add 'raise' option back to strict_qt in make_napari_viewer (#6335)
Browse files Browse the repository at this point in the history
# References and relevant issues
https://github.com/napari/napari/pull/5373/files#r1356648322

# Description

- Typo fixes
- Add 'raise' option back to `strict_qt` in `make_napari_viewer` - this
may have been removed by mistake:
https://github.com/napari/napari/pull/5373/files#r1356648322

---------

Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
  • Loading branch information
lucyleeow and Czaki committed Oct 18, 2023
1 parent d1388bd commit cd2dcc2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions napari/utils/_testsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def make_napari_viewer(

viewers: WeakSet[Viewer] = WeakSet()

# may be overridden by using `make_napari_viewer(strict=True)`
# may be overridden by using the parameter `strict_qt`
_strict = False

initial = QApplication.topLevelWidgets()
Expand Down Expand Up @@ -283,7 +283,7 @@ def actual_factory(
assert _do_not_inline_below == 0

# only check for leaked widgets if an exception was raised during the test,
# or "strict" mode was used.
# and "strict" mode was used.
if _strict and getattr(sys, 'last_value', None) is prior_exception:
QApplication.processEvents()
leak = set(QApplication.topLevelWidgets()).difference(initial)
Expand All @@ -304,7 +304,7 @@ def actual_factory(
# in particular with VisPyCanvas, it looks like if a traceback keeps
# contains the type, then instances are still attached to the type.
# I'm not too sure why this is the case though.
if _strict:
if _strict == 'raise':
raise AssertionError(msg)
else:
warnings.warn(msg)
Expand Down

0 comments on commit cd2dcc2

Please sign in to comment.