def test_parse_next_release_unsupported(self, mock_download): # We should jump over an unsupported release. LP: #1497024 meta = MetaReleaseCore() meta.current_dist_name = "foo" with tempfile.TemporaryFile() as f: f.write("""Dist: foo Supported: 1 Date: Thu, 26 Oct 2006 12:00:00 UTC Version: 1.0 Dist: goo Supported: 0 Date: Thu, 26 Oct 2016 12:00:00 UTC Version: 2.0 Dist: hoo Supported: 1 Date: Thu, 26 Oct 2026 12:00:00 UTC Version: 3.0 """.encode("utf-8")) f.seek(0) meta.metarelease_information = f meta.parse() self.assertEqual(meta.upgradable_to.name, "hoo") self.assertEqual(meta.upgradable_to.version, "3.0") self.assertEqual(meta.upgradable_to.supported, True)
def get_new_dist(): """ common code to test new dist fetching, get the new dist information for hardy+1 """ meta = MetaReleaseCore() #meta.DEBUG = True meta.current_dist_name = "lucid" meta.METARELEASE_URI = "http://changelogs.ubuntu.com/meta-release" while meta.downloading: time.sleep(0.1) meta._buildMetaReleaseFile() meta.download() return meta.new_dist
def get_new_dist(current_release): """ common code to test new dist fetching, get the new dist information for hardy+1 """ meta = MetaReleaseCore() #meta.DEBUG = True meta.current_dist_name = current_release fake_metarelease = os.path.join(os.getcwd(), "test-data", "meta-release") meta.METARELEASE_URI = "file://%s" % fake_metarelease while meta.downloading: time.sleep(0.1) meta._buildMetaReleaseFile() meta.download() return meta.new_dist
def get_new_dist(): """ common code to test new dist fetching, get the new dist information for trusty+1 """ shutil.rmtree(tmpdir) meta = MetaReleaseCore() #meta.DEBUG = True meta.current_dist_name = "trusty" meta.METARELEASE_URI = \ "https://changelogs.ubuntu.com/meta-release-development" meta.downloaded.wait() meta._buildMetaReleaseFile() meta.download() return meta.new_dist
def get_new_dist(current_release): """ common code to test new dist fetching, get the new dist information for hardy+1 """ meta = MetaReleaseCore() #meta.DEBUG = True meta.current_dist_name = current_release fake_metarelease = os.path.join(CURDIR, "test-data", "meta-release") meta.METARELEASE_URI = "file://%s" % fake_metarelease while meta.downloading: time.sleep(0.1) meta._buildMetaReleaseFile() meta.download() return meta.new_dist
def test_parse_good(self, mock_download): meta = MetaReleaseCore() meta.current_dist_name = "foo" with tempfile.TemporaryFile() as f: f.write("""Dist: foo Supported: 1 Date: Thu, 26 Oct 2006 12:00:00 UTC Version: 1.0 Dist: goo Supported: 1 Date: Thu, 26 Oct 2016 12:00:00 UTC Version: 2.0 """.encode("utf-8")) f.seek(0) meta.metarelease_information = f meta.parse() self.assertEqual(meta.upgradable_to.name, "goo") self.assertEqual(meta.upgradable_to.version, "2.0") self.assertEqual(meta.upgradable_to.supported, True)
def test_parse_next_release_unsupported_devel(self, mock_download): # We should not jump over an unsupported release if we are running in # "devel" mode. LP: #1497024 meta = MetaReleaseCore() meta.current_dist_name = "foo" meta.useDevelopmentRelease = True with tempfile.TemporaryFile() as f: f.write("""Dist: foo Supported: 1 Date: Thu, 26 Oct 2006 12:00:00 UTC Version: 1.0 Dist: goo Supported: 0 Date: Thu, 26 Oct 2016 12:00:00 UTC Version: 2.0 """.encode("utf-8")) f.seek(0) meta.metarelease_information = f meta.parse() self.assertEqual(meta.upgradable_to.name, "goo") self.assertEqual(meta.upgradable_to.version, "2.0") self.assertEqual(meta.upgradable_to.supported, False)