2
2
import sys
3
3
import time
4
4
import threading
5
+ import unittest
5
6
import yappi
6
7
import _yappi
7
8
import utils
8
9
import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6
9
10
import subprocess
10
11
11
- if sys .version_info < (2 , 7 ): # use unittest2 for < Py2.7
12
- import unittest2 as _unittest
13
- else :
14
- import unittest as _unittest
15
12
16
13
class BasicUsage (utils .YappiUnitTestCase ):
17
14
@@ -964,7 +961,7 @@ def worker():
964
961
#yappi.get_func_stats().sort("callcount").print_all()
965
962
yappi .stop ()
966
963
967
- @_unittest .skipIf (os .name != "posix" , "requires Posix compliant OS" )
964
+ @unittest .skipIf (os .name != "posix" , "requires Posix compliant OS" )
968
965
def test_signals_with_blocking_calls (self ):
969
966
import signal , os , time
970
967
# just to verify if signal is handled correctly and stats/yappi are not corrupted.
@@ -978,7 +975,7 @@ def handler(signum, frame):
978
975
fsh = utils .find_stat_by_name (stats , "handler" )
979
976
self .assertTrue (fsh is not None )
980
977
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" )
982
979
def test_concurrent_futures (self ):
983
980
yappi .start ()
984
981
from concurrent .futures import ThreadPoolExecutor
@@ -988,7 +985,7 @@ def test_concurrent_futures(self):
988
985
time .sleep (1.0 )
989
986
yappi .stop ()
990
987
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" )
992
989
def test_barrier (self ):
993
990
yappi .start ()
994
991
b = threading .Barrier (2 , timeout = 1 )
@@ -1414,4 +1411,4 @@ def b():
1414
1411
if __name__ == '__main__' :
1415
1412
# import sys;sys.argv = ['', 'BasicUsage.test_run_as_script']
1416
1413
# import sys;sys.argv = ['', 'MultithreadedScenarios.test_subsequent_profile']
1417
- _unittest .main ()
1414
+ unittest .main ()
0 commit comments