def check_gcdt_update(): """Check whether a newer gcdt is available and output a warning. """ inst_version, latest_version = get_package_versions('gcdt') if inst_version < latest_version: print(colored.yellow('Please consider an update to gcdt version: %s' % latest_version))
def test_get_package_versions(): ipli = iter([Bunch(parsed_version='0.0.77', latest_version='0.0.88')]) with mock.patch.object(ListCommand, 'iter_packages_latest_infos', return_value=ipli): installed_version, latest_available_version = get_package_versions('gcdt') assert installed_version == '0.0.77' assert latest_available_version == '0.0.88'
def test_get_package_versions_not_installed(): ipli = iter([]) with mock.patch.object(ListCommand, 'iter_packages_latest_infos', return_value=ipli): installed_version, latest_available_version = \ get_package_versions('not_installed') assert installed_version is None assert latest_available_version is None