Bug 1653662: [mozrelease] Update mozrelease subcommands to python 3; r=aki
authorTom Prince <mozilla@hocat.ca>
Sat, 18 Jul 2020 01:36:36 +0000
changeset 541015 c7ab0fccb72af2aba4c9ded7032bd4f369886303
parent 541014 d3740f55f2ffd6f3e7f22726c05f7b303d4837b1
child 541016 694a4afe955330bb050d20002afd897c6aa77fcb
push id37613
push userbtara@mozilla.com
push dateSat, 18 Jul 2020 09:26:25 +0000
treeherdermozilla-central@08cd64cdbc3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaki
bugs1653662
milestone80.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1653662: [mozrelease] Update mozrelease subcommands to python 3; r=aki Differential Revision: https://phabricator.services.mozilla.com/D84042
mach
python/mozrelease/mozrelease/buglist_creator.py
python/mozrelease/test/python.ini
python/mozrelease/test/test_update_verify.py
--- a/mach
+++ b/mach
@@ -30,17 +30,16 @@ py2commands="
     jstests
     mochitest
     mozharness
     prettier-format
     python-test
     raptor
     raptor-test
     reftest
-    release
     talos-test
     taskcluster-load-image
     taskgraph
     telemetry-tests-client
     test
     tps-build
     visualmetrics
     web-platform-tests
--- a/python/mozrelease/mozrelease/buglist_creator.py
+++ b/python/mozrelease/mozrelease/buglist_creator.py
@@ -164,17 +164,17 @@ def get_previous_tag_version(
         for item in mercurial_tags_json['tags']
         if _invalid_tag_filter(item['tag'])
     }
     # Add the current version to the list
     tags.add((current_version, current_version_tag))
     tags = sorted(tags, key=lambda tag: tag[0])
 
     # Find where the current version is and go back one to get the previous version
-    next_version_index = (map(itemgetter(0), tags).index(current_version) - 1)
+    next_version_index = list(map(itemgetter(0), tags)).index(current_version) - 1
 
     return tags[next_version_index][1]
 
 
 def get_repo_by_version(version):
     """
     Get the repo a given version is found on.
     """
--- a/python/mozrelease/test/python.ini
+++ b/python/mozrelease/test/python.ini
@@ -1,9 +1,7 @@
 [DEFAULT]
 subsuite=mozrelease
 
 [test_versions.py]
 [test_update_verify.py]
-skip-if = python == 3
 [test_balrog.py]
 [test_buglist_creator.py]
-skip-if = python == 3
--- a/python/mozrelease/test/test_update_verify.py
+++ b/python/mozrelease/test/test_update_verify.py
@@ -1,16 +1,15 @@
 # -*- coding: utf-8 -*-
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function
 
-from md5 import md5
 import os
 from tempfile import mkstemp
 import unittest
 from pathlib2 import Path
 
 from mozrelease.update_verify import UpdateVerifyConfig, UpdateVerifyError
 
 import mozunit
@@ -20,17 +19,17 @@ DATA_PATH = Path(__file__).with_name("da
 
 
 class TestUpdateVerifyConfig(unittest.TestCase):
     config = str(DATA_PATH.joinpath("sample-update-verify.cfg"))
 
     def setUp(self):
         self.uvc = UpdateVerifyConfig()
         fd, self.tmpfilename = mkstemp()
-        self.tmpfile = os.fdopen(fd, "w")
+        self.tmpfile = os.fdopen(fd, "wb")
 
     def tearDown(self):
         self.tmpfile.close()
         os.unlink(self.tmpfilename)
 
     def testEq(self):
         self.uvc.product = "foo"
         self.uvc.channel = "betatest"
@@ -187,18 +186,18 @@ class TestUpdateVerifyConfig(unittest.Te
                             ftp_server_to=ftp_server_to)
         self.uvc.addRelease("3.7a1", build_id="666", locales=("en-US",),
                             ftp_server_from=ftp_server_from,
                             ftp_server_to=ftp_server_to,
                             platform="Linux_x86-gcc3")
 
         self.uvc.write(self.tmpfile)
         self.tmpfile.close()
-        self.assertEquals(md5(open(self.config).read()).hexdigest(),
-                          md5(open(self.tmpfilename).read()).hexdigest())
+        self.assertEquals(open(self.config).read(),
+                          open(self.tmpfilename).read())
 
     def testReadInvalidKey(self):
         invalidLine = 'foo="bar"'
         self.assertRaises(UpdateVerifyError, self.uvc._parseLine, invalidLine)
 
     def testReadDuplicateKey(self):
         invalidLine = 'release="bar" release="blah"'
         self.assertRaises(UpdateVerifyError, self.uvc._parseLine, invalidLine)