Example #1
0
  def test_pre_release(self):
    self.assertEqual(Revision.semver('1.2.3-pre1.release.1'),
                     Revision.semver('1.2.3-pre1.release.1'))
    self.assertComponents(Revision.semver('1.2.3-pre1.release.1'),
                          1, 2, 3, 'pre1', 'release', 1, None)

    self.assertTrue(
      Revision.semver('1.2.3-pre1.release.1') < Revision.semver('1.2.3-pre2.release.1'))
    self.assertTrue(
      Revision.semver('1.2.3-pre1.release.2') < Revision.semver('1.2.3-pre1.release.10'))

    self.assertTrue(Revision.semver('1.2.3') < Revision.semver('1.2.3-pre2.release.1'))
Example #2
0
 def _parse_java_version(version):
     # Java version strings have been well defined since release 1.3.1 as defined here:
     #  http://www.oracle.com/technetwork/java/javase/versioning-naming-139433.html
     # These version strings comply with semver except that the traditional pre-release semver
     # slot (the 4th) can be delimited by an _ in the case of update releases of the jdk.
     # We accomodate that difference here.
     return Revision.semver(version.replace('_', '-'))
Example #3
0
 def _parse_java_version(version):
   # Java version strings have been well defined since release 1.3.1 as defined here:
   #  http://www.oracle.com/technetwork/java/javase/versioning-naming-139433.html
   # These version strings comply with semver except that the traditional pre-release semver
   # slot (the 4th) can be delimited by an _ in the case of update releases of the jdk.
   # We accomodate that difference here.
   return Revision.semver(version.replace('_', '-'))
Example #4
0
  def test_validate_version(self):
    with pytest.raises(Distribution.Error):
      with self.distribution(executables=self.exe('java', '1.7.0_25')) as jdk:
        Distribution(bin_path=jdk, minimum_version='1.7.0_45').validate()

    with self.distribution(executables=self.exe('java', '1.7.0_25')) as jdk:
      Distribution(bin_path=jdk, minimum_version='1.7.0_25').validate()
      Distribution(bin_path=jdk, minimum_version=Revision.semver('1.6.0')).validate()
Example #5
0
    def test_pre_release(self):
        self.assertEqual(Revision.semver('1.2.3-pre1.release.1'),
                         Revision.semver('1.2.3-pre1.release.1'))
        self.assertComponents(Revision.semver('1.2.3-pre1.release.1'), 1, 2, 3,
                              'pre1', 'release', 1, None)

        self.assertTrue(
            Revision.semver('1.2.3-pre1.release.1') < Revision.semver(
                '1.2.3-pre2.release.1'))
        self.assertTrue(
            Revision.semver('1.2.3-pre1.release.2') < Revision.semver(
                '1.2.3-pre1.release.10'))

        self.assertTrue(
            Revision.semver('1.2.3') < Revision.semver('1.2.3-pre2.release.1'))
Example #6
0
  def test_pre_release_build(self):
    self.assertEqual(Revision.semver('1.2.3-pre1.release.1+1'),
                     Revision.semver('1.2.3-pre1.release.1+1'))
    self.assertComponents(Revision.semver('1.2.3-pre1.release.1+1'),
                          1, 2, 3, 'pre1', 'release', 1, 1)

    self.assertTrue(
      Revision.semver('1.2.3-pre1.release.1') < Revision.semver('1.2.3-pre2.release.1+1'))
    self.assertTrue(
      Revision.semver('1.2.3-pre1.release.2') > Revision.semver('1.2.3-pre1.release.1+1'))

    self.assertTrue(Revision.semver('1.2.3') < Revision.semver('1.2.3-pre2.release.2+1.foo'))
    self.assertTrue(
      Revision.semver('1.2.3-pre1.release.2+1') < Revision.semver('1.2.3-pre1.release.2+1.foo'))
    self.assertTrue(
      Revision.semver('1.2.3-pre1.release.2+1') < Revision.semver('1.2.3-pre1.release.2+2'))
Example #7
0
  def test_simple(self):
    self.assertEqual(Revision.semver('1.2.3'), Revision.semver('1.2.3'))
    self.assertComponents(Revision.semver('1.2.3'), 1, 2, 3, None, None)

    self.assertTrue(Revision.semver('1.2.3') > Revision.semver('1.2.2'))
    self.assertTrue(Revision.semver('1.3.0') > Revision.semver('1.2.2'))
    self.assertTrue(Revision.semver('1.3.10') > Revision.semver('1.3.2'))
    self.assertTrue(Revision.semver('2.0.0') > Revision.semver('1.3.2'))
Example #8
0
 def test_bad(self):
   for bad_rev in ('a.b.c', '1.b.c', '1.2.c', '1.2.3;4', '1.2.3;4+5'):
     with pytest.raises(Revision.BadRevision):
       Revision.semver(bad_rev)
Example #9
0
    def test_pre_release_build(self):
        self.assertEqual(Revision.semver('1.2.3-pre1.release.1+1'),
                         Revision.semver('1.2.3-pre1.release.1+1'))
        self.assertComponents(Revision.semver('1.2.3-pre1.release.1+1'), 1, 2,
                              3, 'pre1', 'release', 1, 1)

        self.assertTrue(
            Revision.semver('1.2.3-pre1.release.1') < Revision.semver(
                '1.2.3-pre2.release.1+1'))
        self.assertTrue(
            Revision.semver('1.2.3-pre1.release.2') > Revision.semver(
                '1.2.3-pre1.release.1+1'))

        self.assertTrue(
            Revision.semver('1.2.3') < Revision.semver(
                '1.2.3-pre2.release.2+1.foo'))
        self.assertTrue(
            Revision.semver('1.2.3-pre1.release.2+1') < Revision.semver(
                '1.2.3-pre1.release.2+1.foo'))
        self.assertTrue(
            Revision.semver('1.2.3-pre1.release.2+1') < Revision.semver(
                '1.2.3-pre1.release.2+2'))
Example #10
0
    def test_simple(self):
        self.assertEqual(Revision.semver('1.2.3'), Revision.semver('1.2.3'))
        self.assertComponents(Revision.semver('1.2.3'), 1, 2, 3, None, None)

        self.assertTrue(Revision.semver('1.2.3') > Revision.semver('1.2.2'))
        self.assertTrue(Revision.semver('1.3.0') > Revision.semver('1.2.2'))
        self.assertTrue(Revision.semver('1.3.10') > Revision.semver('1.3.2'))
        self.assertTrue(Revision.semver('2.0.0') > Revision.semver('1.3.2'))
Example #11
0
 def test_bad(self):
     for bad_rev in ('a.b.c', '1.b.c', '1.2.c', '1.2.3;4', '1.2.3;4+5'):
         with pytest.raises(Revision.BadRevision):
             Revision.semver(bad_rev)