Skip to content

Commit

Permalink
Suppress ResourceWarning under Py3k.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Mar 17, 2014
1 parent a974b9c commit 4087936
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/zope/component/tests/test_standalone.py
Expand Up @@ -31,21 +31,25 @@ def testStandalone(self):
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
stdin=subprocess.PIPE)
pickle.dump(sys.path, process.stdin)
process.stdin.close()

try:
rc = process.wait()
except OSError as e:
if e.errno != 4: # MacIntel raises apparently unimportant EINTR?
raise # TODO verify sanity of a pass on EINTR :-/
if rc != 0:
output = process.stdout.read()
output = output.decode() if isinstance(output, bytes) else output
sys.stderr.write('#' * 80 + '\n')
sys.stdout.write(output)
sys.stderr.write('#' * 80 + '\n')
self.fail('Output code: %d' % rc)
pickle.dump(sys.path, process.stdin)
process.stdin.close()

try:
rc = process.wait()
except OSError as e:
if e.errno != 4: # MacIntel raises apparently unimportant EINTR?
raise # TODO verify sanity of a pass on EINTR :-/
if rc != 0:
output = process.stdout.read()
if isinstance(output, bytes):
output = output.decode()
sys.stderr.write('#' * 80 + '\n')
sys.stdout.write(output)
sys.stderr.write('#' * 80 + '\n')
self.fail('Output code: %d' % rc)
finally:
process.stdout.close()

def test_suite():
return unittest.TestSuite((
Expand Down

0 comments on commit 4087936

Please sign in to comment.