--- tests/test_import_machinery.py
+++ tests/test_import_machinery.py
@@ -93,8 +93,8 @@
 
         self.assertTrue('InvalidGObjectRepositoryModuleName' in exception_string)
 
-        # The message of the custom exception in gi/importer.py is eaten in Python 2.7
-        if sys.version_info.major < 3:
+        # The message of the custom exception in gi/importer.py is eaten in Python <3.3
+        if sys.version_info < (3, 3):
             self.assertTrue('introspection typelib' not in exception_string)
         else:
             self.assertTrue('introspection typelib' in exception_string)
