def test_version(): # Validate local version local_version = make_version(version) assert isinstance(local_version, int) # Validate version of latest release hlatest_version, latest_version, date = get_latest_version() assert isinstance(latest_version, int) # Validate date of latest release date_format = "%Y-%m-%dT%H:%M:%SZ" datetime.datetime.strptime(date, date_format) # Test a sample dev version to ensure it's older than the stable counterpart sample_stable_version = make_version("2.1.0") sample_dev_version = make_version("2.1.0.dev1") assert sample_stable_version > sample_dev_version
def test_version(): # Validate local version local_version = make_version(version) assert type(local_version) is int # Validate version of latest release latest_version, date = get_latest_version() assert type(latest_version) is int # Validate date of latest release format = "%Y-%m-%dT%H:%M:%SZ" datetime.datetime.strptime(date, format)
def test_update_check(): # Validate local version local_version = make_version(config.version) assert isinstance(local_version, int) # Validate version of latest release try: _hlatest_version, latest_version, date = get_latest_version() assert isinstance(latest_version, int) except socket.gaierror: print("No internet access, skipping update check test!") return # Validate date of latest release date_format = "%Y-%m-%dT%H:%M:%S" datetime.datetime.strptime(date, date_format)
def checklatest(frame): try: latest, date = get_latest_version() myversion = int(make_version(version)) except Exception as m: dlg = gtk.MessageDialog( transient_for=frame, flags=0, type=gtk.MessageType.ERROR, buttons=gtk.ButtonsType.OK, text=_("Could not retrieve version information!\nError: %s") % m ) else: if latest > myversion: dlg = gtk.MessageDialog( transient_for=frame, flags=0, type=gtk.MessageType.INFO, buttons=gtk.ButtonsType.OK, text=_("A newer version %s is available, released on %s.") % (latest, date) ) elif myversion > latest: dlg = gtk.MessageDialog( transient_for=frame, flags=0, type=gtk.MessageType.INFO, buttons=gtk.ButtonsType.OK, text=_("You appear to be using a development version of Nicotine+.") ) else: dlg = gtk.MessageDialog( transient_for=frame, flags=0, type=gtk.MessageType.INFO, buttons=gtk.ButtonsType.OK, text=_("You are using the latest version of Nicotine+.") ) dlg.run() dlg.destroy()
def test_dev_version(): # Test a sample dev version to ensure it's older than the stable counterpart sample_stable_version = make_version("2.1.0") sample_dev_version = make_version("2.1.0.dev1") assert sample_stable_version > sample_dev_version