Merge pull request #1224 from ZyX-I/pypy3

Enable pypy3 tests
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2014-12-08 21:34:35 +03:00
commit 5cfbcd4813
4 changed files with 12 additions and 2 deletions

View File

@ -6,6 +6,7 @@ python:
- "3.3"
- "3.4"
- "pypy"
- "pypy3"
install: tests/install.sh
script: tests/test.sh

View File

@ -134,8 +134,13 @@ except ImportError:
except ImportError:
from getpass import getuser as _get_user
else:
try:
from os import geteuid as getuid
except ImportError:
from os import getuid
def _get_user():
return pwd.getpwuid(os.geteuid()).pw_name
return pwd.getpwuid(getuid()).pw_name
username = False

View File

@ -4,7 +4,7 @@ pip install psutil netifaces
if python -c 'import sys; sys.exit(1 * (sys.version_info[0] != 2))' ; then
# Python 2
if python -c 'import platform, sys; sys.exit(1 - (platform.python_implementation() == "CPython"))' ; then
# PyPy
# CPython
pip install mercurial
pip install --allow-external bzr --allow-unverified bzr bzr
fi

View File

@ -721,6 +721,10 @@ class TestSys(TestCommon):
])
def test_cpu_load_percent(self):
try:
__import__('psutil')
except ImportError as e:
raise SkipTest('Failed to import psutil: {0}'.format(e))
pl = Pl()
with replace_module_module(self.module, 'psutil', cpu_percent=lambda **kwargs: 52.3):
self.assertEqual(common.cpu_load_percent(pl=pl), [{