summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Shepelev <temotor@gmail.com>2013-07-09 20:07:11 +0400
committerSergey Shepelev <temotor@gmail.com>2013-07-09 20:07:11 +0400
commit05928f912a7789a3784c1513a9c975552466daa0 (patch)
tree796e4439686e7c6ebd8beb8ba2bb7b520d4db7be /tests
parentc268aa501e0d59e052bf10daa1f36a189337d0a6 (diff)
downloadeventlet-05928f912a7789a3784c1513a9c975552466daa0.tar.gz
tests: skip check_idle_cpu_usage on Windows; Thanks to Paul Oppenheim
TODO: use psutil package which ought to work on Windows
Diffstat (limited to 'tests')
-rw-r--r--tests/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index 02002fd..b52d6bc 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -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)