#327 Suppress warnings
Merged 8 months ago by jkaluza. Opened 8 months ago by cqi.
cqi/freshmaker fix-warnings  into  master

file modified
+1 -1

@@ -185,7 +185,7 @@ 

      if backend == 'noauth':

          # Do not enable any authentication backend working with frontend

          # authentication module in Apache.

-         log.warn("Authorization is disabled in Freshmaker configuration.")

+         log.warning("Authorization is disabled in Freshmaker configuration.")

          return

      if backend == 'kerberos':

          _validate_kerberos_config()

file modified
+3 -3

@@ -99,13 +99,13 @@ 

                  data = self._get_cve_whiteboard(cve)

              except requests.exceptions.HTTPError as e:

                  if e.response.status_code == 404:

-                     log.warn(

+                     log.warning(

                          "CVE %s cannot be found in bugzilla, "

                          "threat_severity unknown.  %s", cve, e.response.request.url)

                      continue

                  raise

              except IndexError:

-                 log.warn(

+                 log.warning(

                      "CVE %s XML appears malformed.  No children?  "

                      "threat_severity unknown.", cve)

                  continue

@@ -113,7 +113,7 @@ 

              try:

                  severity = data["impact"].lower()

              except KeyError:

-                 log.warn(

+                 log.warning(

                      "CVE %s has no 'impact' in bugzilla whiteboard, "

                      "threat_severity unknown.", cve)

                  continue

@@ -131,7 +131,7 @@ 

          Logs the message `msg` using `log_fnc`, passing msg, *args and **kwargs

          to it.

  

-         :param log_fnc: log.info, log.error, log.warn, ...

+         :param log_fnc: log.info, log.error, log.warning, ...

          :param str msg: Message to log (first argument passed to log_fnc).

          :param *args: Args passed to log_fnc.

          :param **kwargs: Kwargs passed to log_fnc.

@@ -150,11 +150,11 @@ 

          """

          return self._log(log.info, msg, *args, **kwargs)

  

-     def log_warn(self, msg, *args, **kwargs):

+     def log_warning(self, msg, *args, **kwargs):

          """

-         Wraps log.warn, prefixes the message with a context of this handler.

+         Wraps log.warning, prefixes the message with a context of this handler.

          """

-         return self._log(log.warn, msg, *args, **kwargs)

+         return self._log(log.warning, msg, *args, **kwargs)

  

      def log_error(self, msg, *args, **kwargs):

          """

file modified
+2 -2

@@ -352,7 +352,7 @@ 

                  "content_sets": []}

  

          if not repository or not branch or not commit:

-             log.warn("%s: Cannot get additional data from distgit.", nvr)

+             log.warning("%s: Cannot get additional data from distgit.", nvr)

              return data

          if "/" in repository:

              namespace, name = repository.split("/")

@@ -593,7 +593,7 @@ 

              return

  

          # Warn early, in case there is an error in the error handling code below

-         log.warn("Request to %s gave %r" % (response.request.url, response))

+         log.warning("Request to %s gave %r" % (response.request.url, response))

  

          if status_code in (http_client.NOT_FOUND,

                             http_client.INTERNAL_SERVER_ERROR,

file modified
+1 -1

@@ -37,7 +37,7 @@ 

  

  logging.debug("Phasers are set to stun.")

  logging.info("%s tried to build something", username)

- logging.warn("%s failed to build", task_id)

+ logging.warning("%s failed to build", task_id)

  

  """

  

file modified
+2 -2

@@ -107,12 +107,12 @@ 

      try:

          work_queue_put(wrapped_msg)

      except ValueError as e:

-         log.warn("No FreshmakerConsumer found.  Shutting down?  %r" % e)

+         log.warning("No FreshmakerConsumer found.  Shutting down?  %r" % e)

      except AttributeError:

          # In the event that `moksha.hub._hub` hasn't yet been initialized, we

          # need to store messages on the side until it becomes available.

          # As a last-ditch effort, try to hang initial messages in the config.

-         log.warn("Hub not initialized.  Queueing on the side.")

+         log.warning("Hub not initialized.  Queueing on the side.")

          _initial_messages.append(wrapped_msg)

  

  

file modified
+6 -6

@@ -85,9 +85,9 @@ 

      # system as the web views.

      app.config['SERVER_NAME'] = 'localhost'

      with app.app_context():

-         log.warn("get_url_for() has been called without the Flask "

-                  "app_context. That can lead to SQLAlchemy errors caused by "

-                  "multiple session being used in the same time.")

+         log.warning("get_url_for() has been called without the Flask "

+                     "app_context. That can lead to SQLAlchemy errors caused by "

+                     "multiple session being used in the same time.")

          return url_for(*args, **kwargs)

  

  

@@ -161,8 +161,8 @@ 

                      return function(*args, **kwargs)

                  except wait_on as e:

                      if logger is not None:

-                         logger.warn("Exception %r raised from %r.  Retry in %rs",

-                                     e, function, interval)

+                         logger.warning("Exception %r raised from %r.  Retry in %rs",

+                                        e, function, interval)

                      time.sleep(interval)

          return inner

      return wrapper

@@ -192,7 +192,7 @@ 

          except OSError as exc:

              # Okay, we failed to delete temporary dir.

              if logger:

-                 logger.warn('Error removing %s: %s', dir, exc.strerror)

+                 logger.warning('Error removing %s: %s', dir, exc.strerror)

  

  

  def clone_repo(url, dest, branch='master', logger=None, commit=None):

@@ -22,6 +22,7 @@ 

  import json

  import mock

  import os

+ import six

  import sys

  import unittest

  

@@ -259,7 +260,7 @@ 

  

          self.handler.handle(event)

          self.assertEqual(build.state, ArtifactBuildState.FAILED.value)

-         self.assertRegexpMatches(build.state_reason, r"The following RPMs in container build.*")

+         six.assertRegex(self, build.state_reason, r"The following RPMs in container build.*")

  

  

  if __name__ == '__main__':

@@ -22,6 +22,7 @@ 

  # Written by Chenxiong Qi <cqi@redhat.com>

  

  import json

+ import six

  

  from mock import patch, PropertyMock, Mock, call

  

@@ -57,7 +58,8 @@ 

  

          handler = ErrataAdvisoryRPMsSignedHandler()

  

-         self.assertRaisesRegexp(

+         six.assertRaisesRegex(

+             self,

              ValueError,

              'Build bind-dyndb-ldap-2.3-8.el6 does not have a SRPM',

              handler._find_build_srpm_name,