Пример #1
0
 def update_from_pypi(self):
     """Call get_latest_version and then save the object."""
     package = pypi.Package(self.package_name)
     self.licence = package.licence()
     self.latest_version = package.latest_version()
     self.next_version = package.next_version(self.current_version)
     self.diff_status = pypi.version_diff(self.current_version, self.latest_version)
     self.checked_pypi_at = tz_now()
     self.save()
     return self
Пример #2
0
 def update_from_pypi(self):
     """Call get_latest_version and then save the object."""
     package = pypi.Package(self.package_name)
     self.licence = package.licence()
     if self.is_parseable:
         self.latest_version = package.latest_version()
         self.next_version = package.next_version(self.current_version)
         self.diff_status = pypi.version_diff(self.current_version,
                                              self.latest_version)
     self.checked_pypi_at = tz_now()
     self.save()
     return self
Пример #3
0
    def test_version_diff(self):
        self.assertEqual(pypi.version_diff(None, None), 'unknown')
        self.assertEqual(pypi.version_diff(None, self.v_0_0_1), 'unknown')
        self.assertEqual(pypi.version_diff(self.v_0_0_1, None), 'unknown')
        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_0_1_0),
                         'minor')

        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_0_0_1), 'none')
        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_0_0_2),
                         'patch')
        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_0_1_0),
                         'minor')
        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_1_0_0),
                         'major')

        self.assertEqual(pypi.version_diff(self.v_0_0_2, self.v_0_0_1),
                         'patch')
        self.assertEqual(pypi.version_diff(self.v_0_0_2, self.v_0_0_2), 'none')
        self.assertEqual(pypi.version_diff(self.v_0_0_2, self.v_0_1_0),
                         'minor')
        self.assertEqual(pypi.version_diff(self.v_0_0_2, self.v_1_0_0),
                         'major')

        self.assertEqual(pypi.version_diff(self.v_0_1_0, self.v_0_0_1),
                         'minor')
        self.assertEqual(pypi.version_diff(self.v_0_1_0, self.v_0_0_2),
                         'minor')
        self.assertEqual(pypi.version_diff(self.v_0_1_0, self.v_0_1_0), 'none')
        self.assertEqual(pypi.version_diff(self.v_0_1_0, self.v_1_0_0),
                         'major')

        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_0_0_1),
                         'major')
        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_0_0_2),
                         'major')
        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_0_1_0),
                         'major')
        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_1_0_0), 'none')

        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_other),
                         'other')
    def test_version_diff(self):
        self.assertEqual(pypi.version_diff(None, None), "unknown")
        self.assertEqual(pypi.version_diff(None, self.v_0_0_1), "unknown")
        self.assertEqual(pypi.version_diff(self.v_0_0_1, None), "unknown")
        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_0_1_0),
                         "minor")

        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_0_0_1), "none")
        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_0_0_2),
                         "patch")
        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_0_1_0),
                         "minor")
        self.assertEqual(pypi.version_diff(self.v_0_0_1, self.v_1_0_0),
                         "major")

        self.assertEqual(pypi.version_diff(self.v_0_0_2, self.v_0_0_1),
                         "patch")
        self.assertEqual(pypi.version_diff(self.v_0_0_2, self.v_0_0_2), "none")
        self.assertEqual(pypi.version_diff(self.v_0_0_2, self.v_0_1_0),
                         "minor")
        self.assertEqual(pypi.version_diff(self.v_0_0_2, self.v_1_0_0),
                         "major")

        self.assertEqual(pypi.version_diff(self.v_0_1_0, self.v_0_0_1),
                         "minor")
        self.assertEqual(pypi.version_diff(self.v_0_1_0, self.v_0_0_2),
                         "minor")
        self.assertEqual(pypi.version_diff(self.v_0_1_0, self.v_0_1_0), "none")
        self.assertEqual(pypi.version_diff(self.v_0_1_0, self.v_1_0_0),
                         "major")

        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_0_0_1),
                         "major")
        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_0_0_2),
                         "major")
        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_0_1_0),
                         "major")
        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_1_0_0), "none")

        self.assertEqual(pypi.version_diff(self.v_1_0_0, self.v_other),
                         "other")