Merge remote-tracking branch 'origin/pr/3700'
This commit is contained in:
commit
591883656e
@ -269,6 +269,8 @@ def _os_info():
|
||||
else:
|
||||
versioninfo = '.'.join(versioninfo)
|
||||
osver = ', '.join([e for e in [release, versioninfo, machine] if e])
|
||||
elif utils.is_posix:
|
||||
osver = ' '.join(platform.uname())
|
||||
else:
|
||||
osver = '?'
|
||||
lines.append('OS Version: {}'.format(osver))
|
||||
|
@ -246,6 +246,8 @@ def apply_fake_os(monkeypatch, request):
|
||||
elif name == 'linux':
|
||||
linux = True
|
||||
posix = True
|
||||
elif name == 'posix':
|
||||
posix = True
|
||||
else:
|
||||
raise ValueError("Invalid fake_os {}".format(name))
|
||||
|
||||
|
@ -707,6 +707,15 @@ class TestOsInfo:
|
||||
expected = ['OS Version: {}'.format(mac_ver_str)]
|
||||
assert ret == expected
|
||||
|
||||
@pytest.mark.fake_os('posix')
|
||||
def test_posix_fake(self, monkeypatch):
|
||||
"""Test with a fake posix platform."""
|
||||
uname_tuple = ('PosixOS', 'localhost', '1.0', '1.0', 'i386', 'i386')
|
||||
monkeypatch.setattr(version.platform, 'uname', lambda: uname_tuple)
|
||||
ret = version._os_info()
|
||||
expected = ['OS Version: %s' % ' '.join(uname_tuple)]
|
||||
assert ret == expected
|
||||
|
||||
@pytest.mark.fake_os('unknown')
|
||||
def test_unknown_fake(self):
|
||||
"""Test with a fake unknown platform."""
|
||||
@ -729,6 +738,11 @@ class TestOsInfo:
|
||||
"""Make sure there are no exceptions with a real macOS."""
|
||||
version._os_info()
|
||||
|
||||
@pytest.mark.posix
|
||||
def test_posix_real(self):
|
||||
"""Make sure there are no exceptions with a real posix."""
|
||||
version._os_info()
|
||||
|
||||
|
||||
class TestPDFJSVersion:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user