Repository: fedora-infra/bodhi

Issue:
Drop Python 2 support for bodhi.client
We need to wait until no packages depend on it, but when we are able to we should drop Python 2 support from ```bodhi.client```.


Discussion:
No packages depend on the Python 2 version of Bodhi in Fedora 30 now.

Resolving patch:
diff --git a/bodhi/client/__init__.py b/bodhi/client/__init__.py
--- a/bodhi/client/__init__.py
+++ b/bodhi/client/__init__.py
@@ -28,7 +28,6 @@
 import functools
 
 import click
-import six
 import munch
 
 from bodhi.client import bindings
@@ -308,7 +307,7 @@ def info_compose(release, request, url, **kwargs):
     try:
         resp = client.get_compose(release, request)
     except bindings.ComposeNotFound as exc:
-        raise click.BadParameter(six.text_type(exc), param_hint='RELEASE/REQUEST')
+        raise click.BadParameter(str(exc), param_hint='RELEASE/REQUEST')
 
     print_resp(resp, client)
 
@@ -621,7 +620,7 @@ def request(update, state, user, password, url, openid_api, **kwargs):
     try:
         resp = client.request(update, state)
     except bindings.UpdateNotFound as exc:
-        raise click.BadParameter(six.text_type(exc), param_hint='UPDATE')
+        raise click.BadParameter(str(exc), param_hint='UPDATE')
 
     print_resp(resp, client)
 
diff --git a/bodhi/client/bindings.py b/bodhi/client/bindings.py
--- a/bodhi/client/bindings.py
+++ b/bodhi/client/bindings.py
@@ -25,6 +25,7 @@
 .. moduleauthor:: Randy Barlow <bowlofeggs@fedoraproject.org>
 """
 
+import configparser
 import datetime
 import functools
 import getpass
@@ -35,8 +36,6 @@
 import re
 import textwrap
 
-from six.moves import configparser
-from six.moves import input
 try:
     import dnf
 except ImportError:  # pragma: no cover
@@ -44,7 +43,6 @@
     dnf = None  # pragma: no cover
 import koji
 import requests.exceptions
-import six
 
 from fedora.client import AuthError, OpenIdBaseClient, FedoraClientError, ServerError
 import fedora.client.openidproxyclient
@@ -69,7 +67,7 @@ class UpdateNotFound(BodhiClientException):
 
     def __init__(self, update):
         """Initialize the Exception."""
-        self.update = six.text_type(update)
+        self.update = str(update)
 
     def __unicode__(self):
         """
@@ -89,8 +87,8 @@ class ComposeNotFound(BodhiClientException):
 
     def __init__(self, release, request):
         """Initialize the Exception."""
-        self.release = six.text_type(release)
-        self.request = six.text_type(request)
+        self.release = str(release)
+        self.request = str(request)
 
     def __unicode__(self):
         """
@@ -739,7 +737,7 @@ def override_str(override, minimal=True):
         Returns:
             basestring: A human readable string describing the given override.
         """
-        if isinstance(override, six.string_types):
+        if isinstance(override, str):
             return override
 
         if minimal:
@@ -770,7 +768,7 @@ def update_str(self, update, minimal=False):
         Returns:
             basestring: A human readable string describing the given update.
         """
-        if isinstance(update, six.string_types):
+        if isinstance(update, str):
             return update
         if minimal:
             val = ""
@@ -852,7 +850,7 @@ def update_str(self, update, minimal=False):
                 waiver_line_formatter = line_formatter.replace(': ', '  ')
                 update_lines += [
                     waiver_line_formatter.format(indent, line)
-                    for indent, line in six.moves.zip(
+                    for indent, line in zip(
                         itertools.repeat(' ', len(waivers_lines) - 1),
                         waivers_lines[1:])
                 ]
@@ -868,7 +866,7 @@ def update_str(self, update, minimal=False):
             indent_lines = ['Bugs'] + [' '] * (len(bugs) - 1)
             update_lines += [
                 line_formatter.format(indent, line)
-                for indent, line in six.moves.zip(indent_lines, bugs)
+                for indent, line in zip(indent_lines, bugs)
             ]
 
         if update['notes']:
@@ -876,7 +874,7 @@ def update_str(self, update, minimal=False):
                 *[wrap_line(line) for line in update['notes'].splitlines()]
             ))
             indent_lines = ['Notes'] + [' '] * (len(notes_lines) - 1)
-            for indent, line in six.moves.zip(indent_lines, notes_lines):
+            for indent, line in zip(indent_lines, notes_lines):
                 update_lines.append(line_formatter.format(indent, line))
 
         update_lines += [
@@ -897,7 +895,7 @@ def update_str(self, update, minimal=False):
             comment_line_formatter = line_formatter.replace(': ', '  ')
             update_lines += [
                 comment_line_formatter.format(indent, line)
-                for indent, line in six.moves.zip(
+                for indent, line in zip(
                     itertools.repeat(' ', len(comments_lines) - 1),
                     comments_lines[1:])
             ]
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -64,7 +64,7 @@ def get_requirements(requirements_file='requirements.txt'):
     version=VERSION,
     description='bodhi common package',
     long_description=README,
-    classifiers=CLASSIFIERS + ['Programming Language :: Python :: 2.7'],
+    classifiers=CLASSIFIERS,
     license=LICENSE,
     maintainer=MAINTAINER,
     maintainer_email=MAINTAINER_EMAIL,
@@ -80,8 +80,6 @@ def get_requirements(requirements_file='requirements.txt'):
         'pytest',
         'pytest-cov',
         'webtest',
-        'mock',
-        'six',
         'conu >= 0.5.0',
         'munch',
         'psycopg2',
@@ -98,7 +96,7 @@ def get_requirements(requirements_file='requirements.txt'):
     version=VERSION,
     description='bodhi client',
     long_description=README,
-    classifiers=CLASSIFIERS + ['Programming Language :: Python :: 2.7'],
+    classifiers=CLASSIFIERS,
     license=LICENSE,
     maintainer=MAINTAINER,
     maintainer_email=MAINTAINER_EMAIL,
@@ -108,7 +106,7 @@ def get_requirements(requirements_file='requirements.txt'):
     packages=['bodhi.client'],
     include_package_data=False,
     zip_safe=False,
-    install_requires=['click', 'python-fedora >= 0.9.0', 'six'],
+    install_requires=['click', 'python-fedora >= 0.9.0'],
     entry_points="""\
     [console_scripts]
     bodhi = bodhi.client:cli


Test patch:
diff --git a/bodhi/tests/client/test___init__.py b/bodhi/tests/client/test___init__.py
--- a/bodhi/tests/client/test___init__.py
+++ b/bodhi/tests/client/test___init__.py
@@ -17,6 +17,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This module contains tests for bodhi.client."""
+from unittest import mock
 import datetime
 import os
 import platform
@@ -27,16 +28,13 @@
 from click import testing
 import click
 import fedora.client
-import mock
 import munch
-import six
 
 from bodhi import client
 from bodhi.client import bindings, AuthError
 from bodhi.tests import client as client_test_data
 from bodhi.tests.utils import compare_output
 
-builtin_module_name = 'builtins' if six.PY3 else '__builtin__'
 
 EXPECTED_DEFAULT_BASE_URL = os.environ.get('BODHI_URL', bindings.BASE_URL)
 
@@ -836,7 +834,7 @@ def test_query_mine_flag_username_unset(self, mock_input, send_request):
         mock_input.return_value = 'dudemcpants'
 
         with mock.patch.dict('os.environ'):
-            with mock.patch('{}.open'.format(builtin_module_name), create=True) as mock_open:
+            with mock.patch('builtins.open', create=True) as mock_open:
                 mock_open.side_effect = fake_open_no_session_cache
                 runner = testing.CliRunner()
                 res = runner.invoke(client.query, ['--mine'])
@@ -1021,7 +1019,7 @@ def test_queryoverrides_mine_flag_username_unset(self, mock_input, send_request)
         mock_input.return_value = 'dudemcpants'
 
         with mock.patch.dict('os.environ'):
-            with mock.patch('{}.open'.format(builtin_module_name), create=True) as mock_open:
+            with mock.patch('builtins.open', create=True) as mock_open:
                 mock_open.side_effect = fake_open_no_session_cache
                 runner = testing.CliRunner()
                 res = runner.invoke(client.query_buildroot_overrides, ['--mine'])
diff --git a/bodhi/tests/client/test_bindings.py b/bodhi/tests/client/test_bindings.py
--- a/bodhi/tests/client/test_bindings.py
+++ b/bodhi/tests/client/test_bindings.py
@@ -18,20 +18,17 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This module contains tests for bodhi.client.bindings."""
 from datetime import datetime, timedelta
+from unittest import mock
 import copy
 import unittest
 
 import fedora.client
-import mock
 import munch
-import six
 
 from bodhi.client import bindings
 from bodhi.tests import client as client_test_data
 from bodhi.tests.utils import compare_output
 
-builtin_module_name = 'builtins' if six.PY3 else '__builtin__'
-
 
 @mock.patch('fedora.client.openidproxyclient.FEDORA_OPENID_API', 'default')
 class TestBodhiClient___init__(unittest.TestCase):
@@ -173,7 +170,7 @@ class TestBodhiClient_init_username(unittest.TestCase):
     TEST_HOT_SESSION_CACHE = '{"https://bodhi.fedoraproject.org/:bowlofeggs": [["stuff", "login"]]}'
     TEST_OTHER_SESSION_CACHE = '{"https://other_domain/:bowlofeggs": [["stuff", "login"]]}'
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
@@ -195,7 +192,7 @@ def test_auth_cache_empty(self, exists, _load_cookies, mock_input, mock_open):
         mock_open.assert_called_once_with(fedora.client.openidbaseclient.b_SESSION_FILE)
         self.assertEqual(client.username, 'pongou')
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
@@ -217,7 +214,7 @@ def test_auth_cache_empty_object(self, exists, _load_cookies, mock_input, mock_o
         mock_open.assert_called_once_with(fedora.client.openidbaseclient.b_SESSION_FILE)
         self.assertEqual(client.username, 'pongou')
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
@@ -239,7 +236,7 @@ def test_auth_cache_failed(self, exists, _load_cookies, mock_input, mock_open):
         mock_open.assert_called_once_with(fedora.client.openidbaseclient.b_SESSION_FILE)
         self.assertEqual(client.username, 'pongou')
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
@@ -260,7 +257,7 @@ def test_auth_cache_hot(self, exists, _load_cookies, mock_input, mock_open):
         mock_open.assert_called_once_with(fedora.client.openidbaseclient.b_SESSION_FILE)
         self.assertEqual(client.username, 'bowlofeggs')
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.json.loads')
@@ -290,7 +287,7 @@ def fake_keys():
         mock_open.assert_called_once_with(fedora.client.openidbaseclient.b_SESSION_FILE)
         self.assertEqual(client.username, 'correct')
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
@@ -310,7 +307,7 @@ def test_auth_cache_missing(self, exists, _load_cookies, mock_input, mock_open):
         self.assertEqual(mock_open.call_count, 0)
         self.assertEqual(client.username, 'pongou')
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
@@ -332,7 +329,7 @@ def test_auth_cache_other_domain(self, exists, _load_cookies, mock_input, mock_o
         mock_open.assert_called_once_with(fedora.client.openidbaseclient.b_SESSION_FILE)
         self.assertEqual(client.username, 'pongou')
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
@@ -371,7 +368,7 @@ def test_with_csrf_token(self, init_username):
         # No need to init the username since we already have a token.
         self.assertEqual(init_username.call_count, 0)
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
@@ -402,7 +399,7 @@ def test_without_csrf_token_with_cookies(self, exists, _load_cookies, mock_input
         mock_open.assert_called_once_with(fedora.client.openidbaseclient.b_SESSION_FILE)
         self.assertEqual(client.username, 'bowlofeggs')
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.input', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
@@ -1551,7 +1548,7 @@ def test___init__(self):
         exc = bindings.UpdateNotFound('bodhi-2.2.4-1.el7')
 
         self.assertEqual(exc.update, u'bodhi-2.2.4-1.el7')
-        self.assertEqual(type(exc.update), six.text_type)
+        self.assertEqual(type(exc.update), str)
 
     def test___unicode__(self):
         """
@@ -1559,9 +1556,9 @@ def test___unicode__(self):
         """
         exc = bindings.UpdateNotFound('bodhi-2.2.4-1.el7')
 
-        self.assertEqual(six.text_type(exc.update), u'bodhi-2.2.4-1.el7')
-        self.assertEqual(type(six.text_type(exc.update)), six.text_type)
-        self.assertEqual(six.text_type(exc), 'Update not found: bodhi-2.2.4-1.el7')
+        self.assertEqual(str(exc.update), u'bodhi-2.2.4-1.el7')
+        self.assertEqual(type(str(exc.update)), str)
+        self.assertEqual(str(exc), 'Update not found: bodhi-2.2.4-1.el7')
 
 
 class TestBodhiClient_candidates(unittest.TestCase):
@@ -1673,9 +1670,9 @@ def test_parsing_invalid_file(self, exists, read, _load_cookies):
         with self.assertRaises(ValueError) as exc:
             client.parse_file("sad")
 
-        self.assertEqual(six.text_type(exc.exception), 'Invalid input file: sad')
+        self.assertEqual(str(exc.exception), 'Invalid input file: sad')
 
-    @mock.patch('{}.open'.format(builtin_module_name), new_callable=mock.mock_open)
+    @mock.patch('builtins.open', new_callable=mock.mock_open)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies')
     @mock.patch('bodhi.client.bindings.os.path.exists')
     def test_parsing_valid_file(self, exists, _load_cookies, mock_open):
@@ -1739,7 +1736,7 @@ def test_parsing_nonexistant_file(self):
         with self.assertRaises(ValueError) as exc:
             client.parse_file("/tmp/bodhi-test-parsefile2")
 
-        self.assertEqual(six.text_type(exc.exception),
+        self.assertEqual(str(exc.exception),
                          'No such file or directory: /tmp/bodhi-test-parsefile2')
 
 
@@ -1747,7 +1744,7 @@ class TestBodhiClient_testable(unittest.TestCase):
     """
     Test the BodhiClient.testable() method.
     """
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.BodhiClient._load_cookies', mock.MagicMock())
     @mock.patch('bodhi.client.bindings.BodhiClient.get_koji_session')
     @mock.patch('bodhi.client.bindings.dnf')
@@ -1795,7 +1792,7 @@ class TestGetKojiSession(unittest.TestCase):
     """
     This class tests the get_koji_session method.
     """
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.configparser.ConfigParser.readfp')
     @mock.patch("os.path.exists")
     @mock.patch("os.path.expanduser", return_value="/home/dudemcpants/")
@@ -1813,7 +1810,7 @@ def test_koji_conf_in_home_directory(self, get, koji, cookies,
         exists.assert_called_once_with("/home/dudemcpants/.koji/config")
         mock_open.assert_called_once_with("/home/dudemcpants/.koji/config")
 
-    @mock.patch('{}.open'.format(builtin_module_name), create=True)
+    @mock.patch('builtins.open', create=True)
     @mock.patch('bodhi.client.bindings.configparser.ConfigParser.readfp')
     @mock.patch("os.path.exists")
     @mock.patch("os.path.expanduser", return_value="/home/dudemcpants/")
diff --git a/bodhi/tests/server/__init__.py b/bodhi/tests/server/__init__.py
--- a/bodhi/tests/server/__init__.py
+++ b/bodhi/tests/server/__init__.py
@@ -18,7 +18,7 @@
 """Test the bodhi.server package."""
 
 from datetime import datetime, timedelta
-import mock
+from unittest import mock
 
 import sqlalchemy
 
diff --git a/bodhi/tests/server/base.py b/bodhi/tests/server/base.py
--- a/bodhi/tests/server/base.py
+++ b/bodhi/tests/server/base.py
@@ -1,4 +1,4 @@
-# Copyright © 2016-2018 Red Hat, Inc.
+# Copyright © 2016-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -17,7 +17,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """Contains a useful base test class that helps with common testing needs for bodhi.server."""
 from contextlib import contextmanager
-import mock
+from unittest import mock
 import os
 import subprocess
 import unittest
diff --git a/bodhi/tests/server/consumers/test_composer.py b/bodhi/tests/server/consumers/test_composer.py
--- a/bodhi/tests/server/consumers/test_composer.py
+++ b/bodhi/tests/server/consumers/test_composer.py
@@ -15,13 +15,13 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+from unittest import mock
 from urllib.error import HTTPError, URLError
 import urllib.parse as urlparse
 import datetime
 import dummy_threading
 import errno
 import json
-import mock
 import os
 import shutil
 import tempfile
diff --git a/bodhi/tests/server/consumers/test_signed.py b/bodhi/tests/server/consumers/test_signed.py
--- a/bodhi/tests/server/consumers/test_signed.py
+++ b/bodhi/tests/server/consumers/test_signed.py
@@ -1,4 +1,4 @@
-# Copyright © 2016-2018 Red Hat, Inc.
+# Copyright © 2016-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -17,7 +17,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This test suite contains tests for the bodhi.server.consumers.signed module."""
 
-import mock
+from unittest import mock
 import unittest
 
 from bodhi.server.consumers import signed
diff --git a/bodhi/tests/server/consumers/test_updates.py b/bodhi/tests/server/consumers/test_updates.py
--- a/bodhi/tests/server/consumers/test_updates.py
+++ b/bodhi/tests/server/consumers/test_updates.py
@@ -1,4 +1,4 @@
-# Copyright © 2016-2018 Red Hat, Inc. and Caleigh Runge-Hotman
+# Copyright © 2016-2019 Red Hat, Inc. and Caleigh Runge-Hotman
 #
 # This file is part of Bodhi.
 #
@@ -17,8 +17,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This test suite contains tests for the bodhi.server.consumers.updates module."""
 
+from unittest import mock
 import copy
-import mock
 import unittest
 
 import sqlalchemy
diff --git a/bodhi/tests/server/functional/test_users.py b/bodhi/tests/server/functional/test_users.py
--- a/bodhi/tests/server/functional/test_users.py
+++ b/bodhi/tests/server/functional/test_users.py
@@ -1,3 +1,7 @@
+# Copyright © 2014-2019 Red Hat, Inc. and others.
+#
+# This file is part of Bodhi.
+#
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
@@ -12,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-import mock
+from unittest import mock
 
 from bodhi.server.config import config
 from bodhi.server.models import Update, User
diff --git a/bodhi/tests/server/scripts/test_approve_testing.py b/bodhi/tests/server/scripts/test_approve_testing.py
--- a/bodhi/tests/server/scripts/test_approve_testing.py
+++ b/bodhi/tests/server/scripts/test_approve_testing.py
@@ -20,7 +20,7 @@
 """
 from datetime import datetime, timedelta
 from io import StringIO
-from mock import call, patch
+from unittest.mock import call, patch
 
 from fedora_messaging import api, testing as fml_testing
 
diff --git a/bodhi/tests/server/scripts/test_bshell.py b/bodhi/tests/server/scripts/test_bshell.py
--- a/bodhi/tests/server/scripts/test_bshell.py
+++ b/bodhi/tests/server/scripts/test_bshell.py
@@ -1,4 +1,4 @@
-# Copyright © 2018 Sebastian Wojciechowski
+# Copyright © 2018-2019 Sebastian Wojciechowski
 #
 # This file is part of Bodhi.
 #
@@ -19,7 +19,7 @@
 This module contains tests for the bodhi.server.scripts.bshell module.
 """
 
-from mock import patch
+from unittest.mock import patch
 import unittest
 
 from click import testing
diff --git a/bodhi/tests/server/scripts/test_check_policies.py b/bodhi/tests/server/scripts/test_check_policies.py
--- a/bodhi/tests/server/scripts/test_check_policies.py
+++ b/bodhi/tests/server/scripts/test_check_policies.py
@@ -1,4 +1,4 @@
-# Copyright © 2017-2018 Red Hat, Inc.
+# Copyright © 2017-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -17,7 +17,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This module contains tests for the bodhi.server.scripts.check_policies module."""
 
-from mock import patch
+from unittest.mock import patch
 import datetime
 
 from click import testing
diff --git a/bodhi/tests/server/scripts/test_clean_old_composes.py b/bodhi/tests/server/scripts/test_clean_old_composes.py
--- a/bodhi/tests/server/scripts/test_clean_old_composes.py
+++ b/bodhi/tests/server/scripts/test_clean_old_composes.py
@@ -1,3 +1,7 @@
+# Copyright © 2016-2019 Red Hat, Inc.
+#
+# This file is part of Bodhi.
+#
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
@@ -15,7 +19,7 @@
 This module contains tests for the bodhi.server.scripts.clean_old_composes module.
 """
 
-from mock import patch
+from unittest.mock import patch
 import os
 import shutil
 import tempfile
diff --git a/bodhi/tests/server/scripts/test_expire_overrides.py b/bodhi/tests/server/scripts/test_expire_overrides.py
--- a/bodhi/tests/server/scripts/test_expire_overrides.py
+++ b/bodhi/tests/server/scripts/test_expire_overrides.py
@@ -1,4 +1,4 @@
-# Copyright © 2016-2018 Red Hat, Inc. and others.
+# Copyright © 2016-2019 Red Hat, Inc. and others.
 #
 # This file is part of Bodhi.
 #
@@ -18,10 +18,10 @@
 """
 This module contains tests for the bodhi.server.scripts.expire_overrides module.
 """
-import mock
 import unittest
 from datetime import timedelta
 from io import StringIO
+from unittest import mock
 
 from fedora_messaging import api, testing as fml_testing
 
diff --git a/bodhi/tests/server/scripts/test_initializedb.py b/bodhi/tests/server/scripts/test_initializedb.py
--- a/bodhi/tests/server/scripts/test_initializedb.py
+++ b/bodhi/tests/server/scripts/test_initializedb.py
@@ -1,4 +1,4 @@
-# Copyright © 2017-2018 Red Hat, Inc.
+# Copyright © 2017-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -18,7 +18,7 @@
 """Contains tests for the bodhi.server.scripts.initializedb module."""
 
 from io import StringIO
-import mock
+from unittest import mock
 import unittest
 
 from bodhi.server.scripts import initializedb
diff --git a/bodhi/tests/server/scripts/test_sar.py b/bodhi/tests/server/scripts/test_sar.py
--- a/bodhi/tests/server/scripts/test_sar.py
+++ b/bodhi/tests/server/scripts/test_sar.py
@@ -19,9 +19,9 @@
 This module contains tests for the bodhi.server.scripts.sar module.
 """
 
-import mock
 import os
 from datetime import datetime
+from unittest import mock
 
 from click import testing
 
diff --git a/bodhi/tests/server/scripts/test_skopeo_lite.py b/bodhi/tests/server/scripts/test_skopeo_lite.py
--- a/bodhi/tests/server/scripts/test_skopeo_lite.py
+++ b/bodhi/tests/server/scripts/test_skopeo_lite.py
@@ -1,4 +1,4 @@
-# Copyright © 2018 Red Hat, Inc.
+# Copyright © 2018-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -20,9 +20,9 @@
 from base64 import b64encode
 from contextlib import contextmanager
 from urllib.parse import urlparse
+from unittest import mock
 import hashlib
 import json
-import mock
 import os
 import re
 import shutil
diff --git a/bodhi/tests/server/scripts/test_untag_branched.py b/bodhi/tests/server/scripts/test_untag_branched.py
--- a/bodhi/tests/server/scripts/test_untag_branched.py
+++ b/bodhi/tests/server/scripts/test_untag_branched.py
@@ -1,4 +1,4 @@
-# Copyright © 2016-2018 Red Hat, Inc.
+# Copyright © 2016-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -20,7 +20,7 @@
 """
 from datetime import datetime, timedelta
 from io import StringIO
-from mock import call, patch
+from unittest.mock import call, patch
 
 from bodhi.server import models
 from bodhi.server.scripts import untag_branched
diff --git a/bodhi/tests/server/services/test_comments.py b/bodhi/tests/server/services/test_comments.py
--- a/bodhi/tests/server/services/test_comments.py
+++ b/bodhi/tests/server/services/test_comments.py
@@ -1,4 +1,4 @@
-# Copyright © 2014-2018 Red Hat, Inc. and others.
+# Copyright © 2014-2019 Red Hat, Inc. and others.
 #
 # This file is part of Bodhi.
 #
@@ -17,8 +17,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 import copy
-import mock
 from datetime import datetime, timedelta
+from unittest import mock
 
 from fedora_messaging import api, testing as fml_testing
 import webtest
diff --git a/bodhi/tests/server/services/test_errors.py b/bodhi/tests/server/services/test_errors.py
--- a/bodhi/tests/server/services/test_errors.py
+++ b/bodhi/tests/server/services/test_errors.py
@@ -1,4 +1,4 @@
-# Copyright © 2018 Red Hat, Inc.
+# Copyright © 2018-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This module contains tests for bodhi.server.services.errors.py"""
-import mock
+from unittest import mock
 
 from bodhi.tests.server import base
 
diff --git a/bodhi/tests/server/services/test_overrides.py b/bodhi/tests/server/services/test_overrides.py
--- a/bodhi/tests/server/services/test_overrides.py
+++ b/bodhi/tests/server/services/test_overrides.py
@@ -1,4 +1,4 @@
-# Copyright © 2014-2018 Red Hat, Inc. and others.
+# Copyright © 2014-2019 Red Hat, Inc. and others.
 #
 # This file is part of Bodhi.
 #
@@ -17,8 +17,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 from datetime import datetime, timedelta
+from unittest import mock
 import copy
-import mock
 
 from fedora_messaging import api, testing as fml_testing
 import webtest
diff --git a/bodhi/tests/server/services/test_releases.py b/bodhi/tests/server/services/test_releases.py
--- a/bodhi/tests/server/services/test_releases.py
+++ b/bodhi/tests/server/services/test_releases.py
@@ -1,4 +1,4 @@
-# Copyright © 2014-2018 Red Hat, Inc. and others.
+# Copyright © 2014-2019 Red Hat, Inc. and others.
 #
 # This file is part of Bodhi.
 #
@@ -15,7 +15,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-import mock
+from unittest import mock
 import os
 
 import webtest
diff --git a/bodhi/tests/server/services/test_updates.py b/bodhi/tests/server/services/test_updates.py
--- a/bodhi/tests/server/services/test_updates.py
+++ b/bodhi/tests/server/services/test_updates.py
@@ -17,10 +17,10 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This module contains tests for bodhi.server.services.updates."""
 from datetime import datetime, timedelta
-from mock import ANY
+from unittest import mock
+from unittest.mock import ANY
 from urllib import parse as urlparse
 import copy
-import mock
 import re
 import textwrap
 import time
diff --git a/bodhi/tests/server/test___init__.py b/bodhi/tests/server/test___init__.py
--- a/bodhi/tests/server/test___init__.py
+++ b/bodhi/tests/server/test___init__.py
@@ -1,4 +1,4 @@
-# Copyright © 2007-2018 Red Hat, Inc. and others.
+# Copyright © 2007-2019 Red Hat, Inc. and others.
 #
 # This file is part of Bodhi.
 #
@@ -16,8 +16,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This test suite contains tests for bodhi.server.__init__."""
+from unittest import mock
 import collections
-import mock
 import unittest
 
 from pyramid import authentication, authorization, testing
diff --git a/bodhi/tests/server/test_bugs.py b/bodhi/tests/server/test_bugs.py
--- a/bodhi/tests/server/test_bugs.py
+++ b/bodhi/tests/server/test_bugs.py
@@ -17,8 +17,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This test suite contains tests for bodhi.server.bugs."""
 
+from unittest import mock
 import unittest
-import mock
 import xmlrpc.client
 
 from bodhi.server import bugs, models
diff --git a/bodhi/tests/server/test_buildsys.py b/bodhi/tests/server/test_buildsys.py
--- a/bodhi/tests/server/test_buildsys.py
+++ b/bodhi/tests/server/test_buildsys.py
@@ -18,7 +18,7 @@
 """This test suite contains tests for the bodhi.server.buildsys module."""
 
 from threading import Lock
-import mock
+from unittest import mock
 import unittest
 
 import koji
diff --git a/bodhi/tests/server/test_captcha.py b/bodhi/tests/server/test_captcha.py
--- a/bodhi/tests/server/test_captcha.py
+++ b/bodhi/tests/server/test_captcha.py
@@ -1,4 +1,4 @@
-# Copyright © 2016-2018 Red Hat, Inc.
+# Copyright © 2016-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -17,7 +17,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This test suite contains tests for bodhi.server.captcha."""
 
-import mock
+from unittest import mock
 import unittest
 
 import PIL.Image
diff --git a/bodhi/tests/server/test_config.py b/bodhi/tests/server/test_config.py
--- a/bodhi/tests/server/test_config.py
+++ b/bodhi/tests/server/test_config.py
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-import mock
+from unittest import mock
 import unittest
 
 from bodhi.server import config
diff --git a/bodhi/tests/server/test_mail.py b/bodhi/tests/server/test_mail.py
--- a/bodhi/tests/server/test_mail.py
+++ b/bodhi/tests/server/test_mail.py
@@ -1,4 +1,4 @@
-# Copyright 2017-2018 Red Hat, Inc.
+# Copyright 2017-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -17,7 +17,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 """Tests for bodhi.server.mail."""
 
-import mock
+from unittest import mock
 import os
 import smtplib
 import unittest
diff --git a/bodhi/tests/server/test_metadata.py b/bodhi/tests/server/test_metadata.py
--- a/bodhi/tests/server/test_metadata.py
+++ b/bodhi/tests/server/test_metadata.py
@@ -19,8 +19,8 @@
 from datetime import datetime, timedelta
 from hashlib import sha256
 from os.path import join, exists, basename
+from unittest import mock
 import glob
-import mock
 import os
 import shutil
 import tempfile
diff --git a/bodhi/tests/server/test_models.py b/bodhi/tests/server/test_models.py
--- a/bodhi/tests/server/test_models.py
+++ b/bodhi/tests/server/test_models.py
@@ -17,9 +17,9 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """Test suite for bodhi.server.models"""
 from datetime import datetime, timedelta
+from unittest import mock
 import html.parser
 import json
-import mock
 import pickle
 import time
 import unittest
diff --git a/bodhi/tests/server/test_notifications.py b/bodhi/tests/server/test_notifications.py
--- a/bodhi/tests/server/test_notifications.py
+++ b/bodhi/tests/server/test_notifications.py
@@ -17,7 +17,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This test module contains tests for bodhi.server.notifications."""
 
-import mock
+from unittest import mock
 import unittest
 
 from fedora_messaging import api, testing as fml_testing, exceptions as fml_exceptions
diff --git a/bodhi/tests/server/test_push.py b/bodhi/tests/server/test_push.py
--- a/bodhi/tests/server/test_push.py
+++ b/bodhi/tests/server/test_push.py
@@ -18,7 +18,7 @@
 """This test suite contains tests on the bodhi.server.push module."""
 
 from datetime import datetime
-import mock
+from unittest import mock
 
 from click.testing import CliRunner
 import click
diff --git a/bodhi/tests/server/test_renderers.py b/bodhi/tests/server/test_renderers.py
--- a/bodhi/tests/server/test_renderers.py
+++ b/bodhi/tests/server/test_renderers.py
@@ -17,8 +17,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 from io import BytesIO
+from unittest import mock
 import datetime
-import mock
 import re
 
 import PIL.Image
diff --git a/bodhi/tests/server/test_security.py b/bodhi/tests/server/test_security.py
--- a/bodhi/tests/server/test_security.py
+++ b/bodhi/tests/server/test_security.py
@@ -1,4 +1,4 @@
-# Copyright 2014-2018 Red Hat, Inc. and others.
+# Copyright 2014-2019 Red Hat, Inc. and others.
 #
 # This file is part of Bodhi.
 #
@@ -17,7 +17,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """Test the bodhi.server.security module."""
 
-import mock
+from unittest import mock
 import unittest
 
 from cornice import errors
diff --git a/bodhi/tests/server/test_util.py b/bodhi/tests/server/test_util.py
--- a/bodhi/tests/server/test_util.py
+++ b/bodhi/tests/server/test_util.py
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 from xml.etree import ElementTree
-import mock
+from unittest import mock
 import os
 import shutil
 import subprocess
diff --git a/bodhi/tests/server/test_validators.py b/bodhi/tests/server/test_validators.py
--- a/bodhi/tests/server/test_validators.py
+++ b/bodhi/tests/server/test_validators.py
@@ -1,4 +1,4 @@
-# Copyright © 2017-2018 Red Hat, Inc.
+# Copyright © 2017-2019 Red Hat, Inc.
 #
 # This file is part of bodhi.
 #
@@ -16,8 +16,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """This module contains tests for bodhi.server.validators."""
+from unittest import mock
 import datetime
-import mock
 import unittest
 
 from cornice.errors import Errors
diff --git a/bodhi/tests/server/test_webapp.py b/bodhi/tests/server/test_webapp.py
--- a/bodhi/tests/server/test_webapp.py
+++ b/bodhi/tests/server/test_webapp.py
@@ -1,4 +1,4 @@
-# Copyright © 2018 Red Hat, Inc.
+# Copyright © 2018-2019 Red Hat, Inc.
 #
 # This file is part of Bodhi.
 #
@@ -17,7 +17,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 """Tests for bodhi.server.webapp."""
 
-import mock
+from unittest import mock
 import unittest
 
 from bodhi.server import webapp
diff --git a/bodhi/tests/server/views/test_generic.py b/bodhi/tests/server/views/test_generic.py
--- a/bodhi/tests/server/views/test_generic.py
+++ b/bodhi/tests/server/views/test_generic.py
@@ -1,4 +1,4 @@
-# Copyright 2014-2018 Red Hat, Inc. and others.
+# Copyright 2014-2019 Red Hat, Inc. and others.
 #
 # This file is part of Bodhi.
 #
@@ -17,8 +17,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 from datetime import datetime
+from unittest import mock
 import copy
-import mock
 import re
 
 import webtest