22import os , sys , asyncio
33
44from pytestqt .qtbot import QtBot
5+ import pytestqt .exceptions
56
67if sys .platform == 'win32' :
78 asyncio .set_event_loop_policy (asyncio .WindowsSelectorEventLoopPolicy ())
9394sk = cq.Sketch().rect(1,1)
9495"""
9596
97+ TIMEOUT = 10_000
98+
9699def _modify_file (code , path = "test.py" ):
97100 with open (path , "w" , 1 ) as f :
98101 f .write (code )
@@ -150,7 +153,7 @@ def main_clean(qtbot: QtBot, mocker):
150153
151154 win = MainWindow ()
152155 qtbot .addWidget (win )
153- with qtbot .waitExposed (win ):
156+ with qtbot .waitExposed (win , timeout = TIMEOUT ):
154157 win .show ()
155158
156159 editor = win .components ['editor' ]
@@ -165,7 +168,7 @@ def main_clean_do_not_close(qtbot: QtBot, mocker):
165168
166169 win = MainWindow ()
167170 qtbot .addWidget (win )
168- with qtbot .waitExposed (win ):
171+ with qtbot .waitExposed (win , timeout = TIMEOUT ):
169172 win .show ()
170173
171174 editor = win .components ['editor' ]
@@ -181,7 +184,7 @@ def main_multi(qtbot: QtBot, mocker):
181184
182185 win = MainWindow ()
183186 qtbot .addWidget (win )
184- with qtbot .waitExposed (win ):
187+ with qtbot .waitExposed (win , timeout = TIMEOUT ):
185188 win .show ()
186189
187190 editor = win .components ['editor' ]
@@ -662,8 +665,6 @@ def test_editor_autoreload(monkeypatch,editor):
662665
663666 qtbot , editor = editor
664667
665- TIMEOUT = 500
666-
667668 # start out with autoreload enabled
668669 editor .autoreload (True )
669670
@@ -712,7 +713,6 @@ def test_autoreload_nested(editor):
712713
713714 qtbot , editor = editor
714715
715- TIMEOUT = 500
716716
717717 editor .autoreload (True )
718718 editor .preferences ['Autoreload: watch imported modules' ] = True
@@ -1440,7 +1440,6 @@ def makebox(z):
14401440
14411441def test_reload_import_handle_error (tmp_path , main ):
14421442
1443- TIMEOUT = 500
14441443 qtbot , win = main
14451444 editor = win .components ["editor" ]
14461445 debugger = win .components ["debugger" ]
@@ -1481,7 +1480,6 @@ def test_reload_import_handle_error(tmp_path, main):
14811480
14821481def test_modulefinder (tmp_path , main ):
14831482
1484- TIMEOUT = 500
14851483 qtbot , win = main
14861484 editor = win .components ["editor" ]
14871485 debugger = win .components ["debugger" ]
0 commit comments