[migration] NoneType is no longer comparable in py3k
authorRémi Cardona <remi.cardona@logilab.fr>
Mon, 21 Sep 2015 17:51:58 +0200
changeset 10720 201028085e12
parent 10719 065b5ac5c039
child 10721 e9abbaa835f5
[migration] NoneType is no longer comparable in py3k
migration.py
test/unittest_migration.py
--- a/migration.py	Tue Oct 13 12:33:26 2015 +0200
+++ b/migration.py	Mon Sep 21 17:51:58 2015 +0200
@@ -456,6 +456,10 @@
 
 
 def version_strictly_lower(a, b):
+    if a is None:
+        return True
+    if b is None:
+        return False
     if a:
         a = Version(a)
     if b:
--- a/test/unittest_migration.py	Tue Oct 13 12:33:26 2015 +0200
+++ b/test/unittest_migration.py	Mon Sep 21 17:51:58 2015 +0200
@@ -22,7 +22,7 @@
 
 from cubicweb.devtools import TestServerConfiguration
 from cubicweb.cwconfig import CubicWebConfiguration
-from cubicweb.migration import MigrationHelper, filter_scripts
+from cubicweb.migration import MigrationHelper, filter_scripts, version_strictly_lower
 from cubicweb.server.migractions import ServerMigrationHelper
 
 
@@ -89,6 +89,10 @@
                                ((0, 1 ,0), TMIGRDIR+'0.1.0_repository.py')])
         config.__class__.name = 'repository'
 
+    def test_version_strictly_lower(self):
+        self.assertTrue(version_strictly_lower(None, '1.0.0'))
+        self.assertFalse(version_strictly_lower('1.0.0', None))
+
 
 from cubicweb.devtools import ApptestConfiguration, get_test_db_handler