summaryrefslogtreecommitdiff
path: root/tests/test_mainloop.py
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-04-10 12:44:00 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-04-10 12:44:00 +0200
commitd3225f1540e09719caa73e52d402e946da3add24 (patch)
treed7cfec6024a9602b3ee4fcc8fabedf5fcb146bf3 /tests/test_mainloop.py
parent903283119896f3e054694484da4147788b02ce60 (diff)
downloadpygobject-d3225f1540e09719caa73e52d402e946da3add24.tar.gz
Fix test_mainloop.py for Python 3
Diffstat (limited to 'tests/test_mainloop.py')
-rw-r--r--tests/test_mainloop.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/test_mainloop.py b/tests/test_mainloop.py
index 934b23b8..4c7794a0 100644
--- a/tests/test_mainloop.py
+++ b/tests/test_mainloop.py
@@ -4,10 +4,15 @@ import os
import sys
import select
import signal
-import thread
import time
import unittest
+try:
+ from _thread import start_new_thread
+ start_new_thread # pyflakes
+except ImportError:
+ # Python 2
+ from thread import start_new_thread
from gi.repository import GLib
from compathelper import _bytes
@@ -62,7 +67,7 @@ class TestMainLoop(unittest.TestCase):
# create a thread which will terminate upon SIGUSR1 by way of
# interrupting sleep()
orig_handler = signal.signal(signal.SIGUSR1, on_usr1)
- thread.start_new_thread(time.sleep, (10,))
+ start_new_thread(time.sleep, (10,))
# now create two main loops
loop1 = GLib.MainLoop()