From fc43b0dc84722c7b3892aab53a0f01c352bc1431 Mon Sep 17 00:00:00 2001 From: Luiz Carvalho Date: May 20 2020 13:19:48 +0000 Subject: Fix flake8 errors Signed-off-by: Luiz Carvalho --- diff --git a/tests/handlers/koji/test_rebuild_images_on_parent_image_build.py b/tests/handlers/koji/test_rebuild_images_on_parent_image_build.py index 9c5e146..45c3996 100644 --- a/tests/handlers/koji/test_rebuild_images_on_parent_image_build.py +++ b/tests/handlers/koji/test_rebuild_images_on_parent_image_build.py @@ -20,13 +20,10 @@ # SOFTWARE. import json -import os -import sys import unittest from unittest import mock -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) # noqa from tests import get_fedmsg, helpers from freshmaker import db, events, models diff --git a/tests/test_monitor.py b/tests/test_monitor.py index 01e7596..96e1094 100644 --- a/tests/test_monitor.py +++ b/tests/test_monitor.py @@ -57,8 +57,8 @@ class TestViews(helpers.ModelsTestCase): def test_monitor_api_structure(self): resp = self.client.get('/api/1/monitor/metrics') self.assertEqual( - len([l for l in resp.get_data(as_text=True).splitlines() - if l.startswith('# TYPE')]), num_of_metrics) + len([line for line in resp.get_data(as_text=True).splitlines() + if line.startswith('# TYPE')]), num_of_metrics) class ConsumerTest(helpers.ConsumerBaseTest): @@ -127,5 +127,5 @@ def test_standalone_metrics_server(): r = requests.get('http://127.0.0.1:10040/metrics') - assert len([l for l in r.text.splitlines() - if l.startswith('# TYPE')]) == num_of_metrics + assert len([line for line in r.text.splitlines() + if line.startswith('# TYPE')]) == num_of_metrics diff --git a/tests/test_views.py b/tests/test_views.py index 1cd1ad8..5bafeee 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -1185,7 +1185,7 @@ class TestPatchAPI(ViewBaseTest): def test_patch_event_not_allowed(self): with self.test_request_context(user='john_smith'): - resp = self.client.patch(f'/api/1/events/1', json={'action': 'cancel'}) + resp = self.client.patch('/api/1/events/1', json={'action': 'cancel'}) assert resp.status_code == 403 assert resp.json['message'] == ( 'User john_smith does not have any of the following roles: admin, manual_rebuilder'