Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.assertEqual(distro.build_number(best=False),
MODULE_DISTROI.build_number())
self.assertEqual(distro.build_number(best=True),
MODULE_DISTROI.build_number(best=True))
self.assertEqual(distro.like(),
MODULE_DISTROI.like())
self.assertEqual(distro.codename(),
MODULE_DISTROI.codename())
self.assertEqual(distro.info(),
MODULE_DISTROI.info(best=False))
self.assertEqual(distro.info(best=False),
MODULE_DISTROI.info())
self.assertEqual(distro.info(best=True),
MODULE_DISTROI.info(best=True))
self.assertEqual(distro.info(),
MODULE_DISTROI.info(pretty=False))
self.assertEqual(distro.info(pretty=False),
MODULE_DISTROI.info())
self.assertEqual(distro.info(pretty=True),
MODULE_DISTROI.info(pretty=True))
self.assertEqual(distro.os_release_info(),
MODULE_DISTROI.os_release_info())
self.assertEqual(distro.lsb_release_info(),
MODULE_DISTROI.lsb_release_info())
self.assertEqual(distro.distro_release_info(),
MODULE_DISTROI.distro_release_info())
def test_cli_json(self):
command = [sys.executable, '-m', 'distro', '-j']
assert ast.literal_eval(self._run(command)) == distro.info()
self.assertEqual(distro.like(),
MODULE_DISTROI.like())
self.assertEqual(distro.codename(),
MODULE_DISTROI.codename())
self.assertEqual(distro.info(),
MODULE_DISTROI.info(best=False))
self.assertEqual(distro.info(best=False),
MODULE_DISTROI.info())
self.assertEqual(distro.info(best=True),
MODULE_DISTROI.info(best=True))
self.assertEqual(distro.info(),
MODULE_DISTROI.info(pretty=False))
self.assertEqual(distro.info(pretty=False),
MODULE_DISTROI.info())
self.assertEqual(distro.info(pretty=True),
MODULE_DISTROI.info(pretty=True))
self.assertEqual(distro.os_release_info(),
MODULE_DISTROI.os_release_info())
self.assertEqual(distro.lsb_release_info(),
MODULE_DISTROI.lsb_release_info())
self.assertEqual(distro.distro_release_info(),
MODULE_DISTROI.distro_release_info())
os_release_keys = [
'name',
'version',
MODULE_DISTROI.minor_version(best=True))
self.assertEqual(distro.build_number(),
MODULE_DISTROI.build_number(best=False))
self.assertEqual(distro.build_number(best=False),
MODULE_DISTROI.build_number())
self.assertEqual(distro.build_number(best=True),
MODULE_DISTROI.build_number(best=True))
self.assertEqual(distro.like(),
MODULE_DISTROI.like())
self.assertEqual(distro.codename(),
MODULE_DISTROI.codename())
self.assertEqual(distro.info(),
MODULE_DISTROI.info(best=False))
self.assertEqual(distro.info(best=False),
MODULE_DISTROI.info())
self.assertEqual(distro.info(best=True),
MODULE_DISTROI.info(best=True))
self.assertEqual(distro.info(),
MODULE_DISTROI.info(pretty=False))
self.assertEqual(distro.info(pretty=False),
MODULE_DISTROI.info())
self.assertEqual(distro.info(pretty=True),
MODULE_DISTROI.info(pretty=True))
self.assertEqual(distro.os_release_info(),
MODULE_DISTROI.os_release_info())
self.assertEqual(distro.lsb_release_info(),
def get_os_version() -> Tuple[str, LooseVersion]:
system_str = platform.system()
if system_str == "Darwin":
return "macos", LooseVersion(platform.mac_ver()[0])
elif system_str == "Windows":
if LooseVersion(platform.release()) >= LooseVersion("10"):
return "windows" + "_" + get_windows_edition(), LooseVersion(
platform.release())
else:
return "windows", LooseVersion(platform.release())
elif system_str == "Linux":
os_info = distro.info()
return os_info["id"], LooseVersion(os_info["version"])
return "", LooseVersion("0")
os_system = platform.system()
if os.environ and 'ANDROID_ARGUMENT' in os.environ:
os_system = 'android'
p = {
"processor": platform.processor(),
"python_version": platform.python_version(),
"platform": platform.platform(),
"os_release": platform.release(),
"os_system": os_system,
"lbrynet_version": lbrynet_version,
"torba_version": torba_version,
"build": build_type.BUILD, # CI server sets this during build step
}
if p["os_system"] == "Linux":
import distro # pylint: disable=import-outside-toplevel
p["distro"] = distro.info()
p["desktop"] = os.environ.get('XDG_CURRENT_DESKTOP', 'Unknown')
return p