From 47a3980b120aec364dd8f06dcf921fc72a06481a Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 22 Mar 2018 17:25:00 -0700 Subject: [PATCH] Fix some pylint warnings --- src/pylorax/ltmpl.py | 4 ++-- tests/pylorax/test_crossdomain.py | 3 +-- tests/pylorax/test_server.py | 4 ++-- tests/pylorax/test_workspace.py | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py index 9790334c..bc30e4af 100644 --- a/src/pylorax/ltmpl.py +++ b/src/pylorax/ltmpl.py @@ -218,8 +218,8 @@ class LoraxTemplateRunner(object): # log the "ErrorType: this is what happened" line logger.error(" " + exclines[-1].strip()) # and log the entire traceback to the debug log - for line in ''.join(exclines).splitlines(): - logger.debug(" " + line) + for l in ''.join(exclines).splitlines(): + logger.debug(" " + l) if self.fatalerrors: raise diff --git a/tests/pylorax/test_crossdomain.py b/tests/pylorax/test_crossdomain.py index deb5eca8..d3a585b1 100644 --- a/tests/pylorax/test_crossdomain.py +++ b/tests/pylorax/test_crossdomain.py @@ -14,7 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -import inspect import unittest from flask import Flask from datetime import timedelta @@ -97,7 +96,7 @@ class CrossdomainTest(unittest.TestCase): # when attach_to_all is False the decorator will not assign # the Access-Control-* headers to the response - for header, value in response.headers: + for header, _ in response.headers: self.assertFalse(header.startswith('Access-Control-')) diff --git a/tests/pylorax/test_server.py b/tests/pylorax/test_server.py index 24b7f463..ab2d1696 100644 --- a/tests/pylorax/test_server.py +++ b/tests/pylorax/test_server.py @@ -518,8 +518,8 @@ class ServerTestCase(unittest.TestCase): self.assertEqual(200, response.status_code) self.assertTrue(len(response.data) > 1024) # look for some well known strings inside the documentation - self.assertRegexpMatches(response.data, "Lorax [\d.]+ documentation") - self.assertRegexpMatches(response.data, "Copyright \d+, Red Hat, Inc.") + self.assertRegexpMatches(response.data, r"Lorax [\d.]+ documentation") + self.assertRegexpMatches(response.data, r"Copyright \d+, Red Hat, Inc.") def test_api_docs(self): """Test the /api/docs/""" diff --git a/tests/pylorax/test_workspace.py b/tests/pylorax/test_workspace.py index 28aa807d..6313e7fd 100644 --- a/tests/pylorax/test_workspace.py +++ b/tests/pylorax/test_workspace.py @@ -72,7 +72,7 @@ class WorkspaceTest(unittest.TestCase): # The recipe was written by the workspace_write test. with self.assertRaises(recipes.RecipeFileError): with mock.patch('pylorax.api.workspace.recipe_from_toml', side_effect=IOError('TESTING')): - recipe = workspace_read(self.repo, "master", "http-server") + workspace_read(self.repo, "master", "http-server") def test_05_workspace_delete(self): """Test the workspace_delete function"""