Skip to content

Commit

Permalink
issue #406: 3.x syntax fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dw committed Nov 4, 2018
1 parent 586c6ac commit e01c8f2
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions tests/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import time
import traceback

import psutil
import unittest2

import mitogen.core
Expand Down Expand Up @@ -49,6 +48,7 @@ def get_fd_count():
"""
Return the number of FDs open by this process.
"""
import psutil
return psutil.Process().num_fds()


Expand Down Expand Up @@ -185,10 +185,9 @@ def pipe():
with l:
rv = real_pipe()
if mypid == os.getpid():
print
print rv
sys.stdout.write('\n%s\n' % (rv,))
traceback.print_stack(limit=3)
print
sys.stdout.write('\n')
return rv
os.pipe = pipe

Expand All @@ -197,10 +196,9 @@ def socketpair(*args):
with l:
rv = real_socketpair(*args)
if mypid == os.getpid():
print
print '--', args, '->', rv
sys.stdout.write('\n%s -> %s\n' % (args, rv))
traceback.print_stack(limit=3)
print
sys.stdout.write('\n')
return rv
socket.socketpair = socketpair

Expand All @@ -209,21 +207,19 @@ def dup2(*args):
with l:
real_dup2(*args)
if mypid == os.getpid():
print
print '--', args
sys.stdout.write('\n%s\n' % (args,))
traceback.print_stack(limit=3)
print
sys.stdout.write('\n')
os.dup2 = dup2

real_dup = os.dup
def dup(*args):
with l:
rv = real_dup(*args)
if mypid == os.getpid():
print
print '--', args, '->', rv
sys.stdout.write('\n%s -> %s\n' % (args, rv))
traceback.print_stack(limit=3)
print
sys.stdout.write('\n')
return rv
os.dup = dup

Expand Down

0 comments on commit e01c8f2

Please sign in to comment.