fix failing tests on Azure Devops

This commit is contained in:
Tal Einat 2020-11-01 13:01:06 +02:00
parent 19b16a49fe
commit ecab884f56
No known key found for this signature in database
GPG Key ID: 613A98AF4C800CDA
1 changed files with 13 additions and 3 deletions

View File

@ -405,7 +405,17 @@ class ShellSidebarTest(unittest.TestCase):
def setUpClass(cls):
requires('gui')
try:
orig_use_subprocess = idlelib.pyshell.use_subprocess
except AttributeError:
orig_use_subprocess = None
idlelib.pyshell.use_subprocess = False
def cleanup_use_subprocess():
if orig_use_subprocess is not None:
idlelib.pyshell.use_subprocess = orig_use_subprocess
else:
del idlelib.pyshell.use_subprocess
cls.addClassCleanup(cleanup_use_subprocess)
cls.root = root = tk.Tk()
root.withdraw()
@ -497,7 +507,7 @@ class ShellSidebarTest(unittest.TestCase):
for line_index, line in enumerate(input.split('\n')):
if line_index > 0:
text.event_generate('<<newline-and-indent>>')
text.insert('insert', line)
text.insert('insert', line, 'stdin')
def run_test_coroutine(self, coroutine):
root = self.root
@ -514,8 +524,8 @@ class ShellSidebarTest(unittest.TestCase):
exception = exc
root.quit()
else:
root.after_idle(after_callback)
root.after(0, after_callback)
root.after(1, root.after_idle, after_callback)
root.after(0, root.after_idle, after_callback)
root.mainloop()
if exception: