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