tests: skip check_idle_cpu_usage on Windows; Thanks to Paul Oppenheim

TODO: use psutil package which ought to work on Windows
This commit is contained in:
Sergey Shepelev
2013-07-09 20:07:11 +04:00
parent c268aa501e
commit 05928f912a

View File

@@ -1,7 +1,10 @@
# package is named tests, not test, so it won't be confused with test in stdlib
import errno
import os
import resource
try:
import resource
except ImportError:
resource = None
import signal
import unittest
import warnings
@@ -201,6 +204,11 @@ class LimitedTestCase(unittest.TestCase):
def check_idle_cpu_usage(duration, allowed_part):
if resource is None:
# TODO: use https://code.google.com/p/psutil/
from nose.plugins.skip import SkipTest
raise SkipTest('CPU usage testing not supported (`import resource` failed)')
r1 = resource.getrusage(resource.RUSAGE_SELF)
eventlet.sleep(duration)
r2 = resource.getrusage(resource.RUSAGE_SELF)