This way it can be used in other tests as well.
Simple code motion.
---
python/t/test080Version.py | 10 +++-------
python/t/tests_helper.py | 7 +++++++
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/python/t/test080Version.py b/python/t/test080Version.py
index d8ce1cb..42ef56e 100644
--- a/python/t/test080Version.py
+++ b/python/t/test080Version.py
@@ -19,11 +19,7 @@ import unittest
import sys
import os
import guestfs
-
-if sys.version_info >= (3, 0):
- cl = int
-else:
- cl = long
+from .tests_helper import *
class Test080Version (unittest.TestCase):
def setUp (self):
@@ -34,10 +30,10 @@ class Test080Version (unittest.TestCase):
self.assertEqual (self.version['major'], 1)
def test_minor (self):
- self.assertIsInstance (self.version['minor'], cl)
+ self.assertIsInstance (self.version['minor'], int_type)
def test_release (self):
- self.assertIsInstance (self.version['release'], cl)
+ self.assertIsInstance (self.version['release'], int_type)
def test_extra (self):
self.assertIsInstance (self.version['extra'], str)
diff --git a/python/t/tests_helper.py b/python/t/tests_helper.py
index 6bbc4bc..df0afb0 100644
--- a/python/t/tests_helper.py
+++ b/python/t/tests_helper.py
@@ -17,9 +17,16 @@
# Utilities for the tests of the Python bindings.
+import sys
import unittest
+if sys.version_info >= (3, 0):
+ int_type = int
+else:
+ int_type = long
+
+
def skipUnlessLibirtHasCPointer ():
"""
Skip the current class/method if:
--
2.5.0