Author: cito
Date: Fri Nov 20 10:04:44 2015
New Revision: 555
Log:
Proper testing of the version number
Modified:
branches/4.x/module/TEST_PyGreSQL_classic_functions.py
branches/4.x/module/setup.py
trunk/module/TEST_PyGreSQL_classic_functions.py
Modified: branches/4.x/module/TEST_PyGreSQL_classic_functions.py
==============================================================================
--- branches/4.x/module/TEST_PyGreSQL_classic_functions.py Fri Nov 20
06:32:39 2015 (r554)
+++ branches/4.x/module/TEST_PyGreSQL_classic_functions.py Fri Nov 20
10:04:44 2015 (r555)
@@ -17,6 +17,8 @@
except ImportError:
import unittest
+import re
+
import pg # the module under test
@@ -311,11 +313,16 @@
def testVersion(self):
v = pg.version
self.assertIsInstance(v, str)
- v = v.split('.')
- self.assertTrue(2 <= len(v) <= 3)
- for w in v:
- self.assertTrue(1 <= len(w) <= 2)
- self.assertTrue(w.isdigit())
+ # make sure the version conforms to PEP440
+ re_version = r"""^
+ (\d[\.\d]*(?<= \d))
+ ((?:[abc]|rc)\d+)?
+ (?:(\.post\d+))?
+ (?:(\.dev\d+))?
+ (?:(\+(?![.])[a-zA-Z0-9\.]*[a-zA-Z0-9]))?
+ $"""
+ match = re.match(re_version, v, re.X)
+ self.assertIsNotNone(match)
if __name__ == '__main__':
Modified: branches/4.x/module/setup.py
==============================================================================
--- branches/4.x/module/setup.py Fri Nov 20 06:32:39 2015 (r554)
+++ branches/4.x/module/setup.py Fri Nov 20 10:04:44 2015 (r555)
@@ -35,7 +35,7 @@
"""
-version = '4.1.1'
+version = '4.1.2a1'
import sys
Modified: trunk/module/TEST_PyGreSQL_classic_functions.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_classic_functions.py Fri Nov 20 06:32:39
2015 (r554)
+++ trunk/module/TEST_PyGreSQL_classic_functions.py Fri Nov 20 10:04:44
2015 (r555)
@@ -17,6 +17,8 @@
except ImportError:
import unittest
+import re
+
import pg # the module under test
@@ -311,11 +313,16 @@
def testVersion(self):
v = pg.version
self.assertIsInstance(v, str)
- v = v.split('.')
- self.assertTrue(2 <= len(v) <= 3)
- for w in v:
- self.assertTrue(1 <= len(w) <= 2)
- self.assertTrue(w.isdigit())
+ # make sure the version conforms to PEP440
+ re_version = r"""^
+ (\d[\.\d]*(?<= \d))
+ ((?:[abc]|rc)\d+)?
+ (?:(\.post\d+))?
+ (?:(\.dev\d+))?
+ (?:(\+(?![.])[a-zA-Z0-9\.]*[a-zA-Z0-9]))?
+ $"""
+ match = re.match(re_version, v, re.X)
+ self.assertIsNotNone(match)
if __name__ == '__main__':
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql