commit
5cfbcd4813
|
@ -6,6 +6,7 @@ python:
|
||||||
- "3.3"
|
- "3.3"
|
||||||
- "3.4"
|
- "3.4"
|
||||||
- "pypy"
|
- "pypy"
|
||||||
|
- "pypy3"
|
||||||
install: tests/install.sh
|
install: tests/install.sh
|
||||||
script: tests/test.sh
|
script: tests/test.sh
|
||||||
|
|
||||||
|
|
|
@ -134,8 +134,13 @@ except ImportError:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from getpass import getuser as _get_user
|
from getpass import getuser as _get_user
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
from os import geteuid as getuid
|
||||||
|
except ImportError:
|
||||||
|
from os import getuid
|
||||||
|
|
||||||
def _get_user():
|
def _get_user():
|
||||||
return pwd.getpwuid(os.geteuid()).pw_name
|
return pwd.getpwuid(getuid()).pw_name
|
||||||
|
|
||||||
|
|
||||||
username = False
|
username = False
|
||||||
|
|
|
@ -4,7 +4,7 @@ pip install psutil netifaces
|
||||||
if python -c 'import sys; sys.exit(1 * (sys.version_info[0] != 2))' ; then
|
if python -c 'import sys; sys.exit(1 * (sys.version_info[0] != 2))' ; then
|
||||||
# Python 2
|
# Python 2
|
||||||
if python -c 'import platform, sys; sys.exit(1 - (platform.python_implementation() == "CPython"))' ; then
|
if python -c 'import platform, sys; sys.exit(1 - (platform.python_implementation() == "CPython"))' ; then
|
||||||
# PyPy
|
# CPython
|
||||||
pip install mercurial
|
pip install mercurial
|
||||||
pip install --allow-external bzr --allow-unverified bzr bzr
|
pip install --allow-external bzr --allow-unverified bzr bzr
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -721,6 +721,10 @@ class TestSys(TestCommon):
|
||||||
])
|
])
|
||||||
|
|
||||||
def test_cpu_load_percent(self):
|
def test_cpu_load_percent(self):
|
||||||
|
try:
|
||||||
|
__import__('psutil')
|
||||||
|
except ImportError as e:
|
||||||
|
raise SkipTest('Failed to import psutil: {0}'.format(e))
|
||||||
pl = Pl()
|
pl = Pl()
|
||||||
with replace_module_module(self.module, 'psutil', cpu_percent=lambda **kwargs: 52.3):
|
with replace_module_module(self.module, 'psutil', cpu_percent=lambda **kwargs: 52.3):
|
||||||
self.assertEqual(common.cpu_load_percent(pl=pl), [{
|
self.assertEqual(common.cpu_load_percent(pl=pl), [{
|
||||||
|
|
Loading…
Reference in New Issue