Bug 1471625 - Resolve Python 3.5 compat issues in mozinfo;r?davehunt
MozReview-Commit-ID: HdPEVAJnXZf
--- a/testing/mozbase/mozinfo/mozinfo/string_version.py
+++ b/testing/mozbase/mozinfo/mozinfo/string_version.py
@@ -8,17 +8,17 @@ from distutils.version import LooseVersi
class StringVersion(str):
"""
A string version that can be compared with comparison operators.
"""
def __init__(self, vstring):
- str.__init__(self, vstring)
+ super(StringVersion, self).__init__()
self.version = LooseVersion(vstring)
def __repr__(self):
return "StringVersion ('%s')" % self
def __to_version(self, other):
if not isinstance(other, StringVersion):
other = StringVersion(other)
--- a/testing/mozbase/mozinfo/tests/manifest.ini
+++ b/testing/mozbase/mozinfo/tests/manifest.ini
@@ -1,4 +1,3 @@
[DEFAULT]
subsuite = mozbase, os == "linux"
-skip-if = python == 3
[test.py]
--- a/testing/mozbase/mozinfo/tests/test.py
+++ b/testing/mozbase/mozinfo/tests/test.py
@@ -12,16 +12,22 @@ import os
import shutil
import sys
import tempfile
import unittest
import mozinfo
import mozunit
+PY3 = sys.version_info[0] == 3
+
+if PY3:
+ # reload() has been moved to importlib in Python 3
+ # see https://docs.python.org/3.5/library/importlib.html#importlib.reload
+ from importlib import reload
class TestMozinfo(unittest.TestCase):
def setUp(self):
reload(mozinfo)
self.tempdir = os.path.abspath(tempfile.mkdtemp())
# When running from an objdir mozinfo will use a build generated json file