Example #1
0
 def test_generate_new_patch_version_returns_expected_value(self):
     self._mock_version_list(
         ['1.1.3', '1.1.4', '1.2', '1.8', '1.8.6', '1.9a1', '1.9b1'])
     pv = PackageVersion()
     next_version = pv.generate_next_stable('Django')
     self.assertEqual('1.9', next_version)
     self._mock_version_list(['1'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1.0.1', next_version)
     self._mock_version_list(['1.0'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1.0.1', next_version)
     self._mock_version_list(['0'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('0.0.1', next_version)
     self._mock_version_list([], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('0.0.1', next_version)
     self._mock_version_list(['1.9-a2'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1.9', next_version)
     self._mock_version_list(['1.9'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1.9.1', next_version)
     self._mock_version_list(['1-a2'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1', next_version)
 def test_generate_new_patch_version_returns_expected_value(self):
     self._mock_version_list(['1.1.3', '1.1.4', '1.2', '1.8', '1.8.6', '1.9a1', '1.9b1'])
     pv = PackageVersion()
     next_version = pv.generate_next_stable('Django')
     self.assertEqual('1.9', next_version)
     self._mock_version_list(['1'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1.0.1', next_version)
     self._mock_version_list(['1.0'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1.0.1', next_version)
     self._mock_version_list(['0'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('0.0.1', next_version)
     self._mock_version_list([], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('0.0.1', next_version)
     self._mock_version_list(['1.9-a2'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1.9', next_version)
     self._mock_version_list(['1.9'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1.9.1', next_version)
     self._mock_version_list(['1-a2'], 'Flask')
     next_version = pv.generate_next_stable('Flask')
     self.assertEqual('1', next_version)
Example #3
0
def version():
    import os
    v = os.getenv('PYTHON_PACKAGE_VERSION')
    if v is None:
        try:
            from package_version import PackageVersion
            pv = PackageVersion()
            v = pv.generate_next_stable(package_name='package-version')
        except ImportError:
            v = '0.0.1'
    return v
Example #4
0
def version():
    import os
    v = os.getenv('PYTHON_PACKAGE_VERSION')
    if v is None:
        try:
            from package_version import PackageVersion
            pv = PackageVersion()
            v = pv.generate_next_stable(package_name='package-version')
        except ImportError:
            v = '0.0.1'
    return v