22import sys
33import time
44import threading
5+ import unittest
56import yappi
67import _yappi
78import utils
89import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6
910import subprocess
1011
11- if sys .version_info < (2 , 7 ): # use unittest2 for < Py2.7
12- import unittest2 as _unittest
13- else :
14- import unittest as _unittest
1512
1613class BasicUsage (utils .YappiUnitTestCase ):
1714
@@ -964,7 +961,7 @@ def worker():
964961 #yappi.get_func_stats().sort("callcount").print_all()
965962 yappi .stop ()
966963
967- @_unittest .skipIf (os .name != "posix" , "requires Posix compliant OS" )
964+ @unittest .skipIf (os .name != "posix" , "requires Posix compliant OS" )
968965 def test_signals_with_blocking_calls (self ):
969966 import signal , os , time
970967 # just to verify if signal is handled correctly and stats/yappi are not corrupted.
@@ -978,7 +975,7 @@ def handler(signum, frame):
978975 fsh = utils .find_stat_by_name (stats , "handler" )
979976 self .assertTrue (fsh is not None )
980977
981- @_unittest .skipIf (not sys .version_info >= (3 , 2 ), "requires Python 3.2" )
978+ @unittest .skipIf (not sys .version_info >= (3 , 2 ), "requires Python 3.2" )
982979 def test_concurrent_futures (self ):
983980 yappi .start ()
984981 from concurrent .futures import ThreadPoolExecutor
@@ -988,7 +985,7 @@ def test_concurrent_futures(self):
988985 time .sleep (1.0 )
989986 yappi .stop ()
990987
991- @_unittest .skipIf (not sys .version_info >= (3 , 2 ), "requires Python 3.2" )
988+ @unittest .skipIf (not sys .version_info >= (3 , 2 ), "requires Python 3.2" )
992989 def test_barrier (self ):
993990 yappi .start ()
994991 b = threading .Barrier (2 , timeout = 1 )
@@ -1414,4 +1411,4 @@ def b():
14141411if __name__ == '__main__' :
14151412# import sys;sys.argv = ['', 'BasicUsage.test_run_as_script']
14161413# import sys;sys.argv = ['', 'MultithreadedScenarios.test_subsequent_profile']
1417- _unittest .main ()
1414+ unittest .main ()
0 commit comments