diff --git a/refstack_client/list_parser.py b/refstack_client/list_parser.py index 1fb9de2..ba0ebc2 100644 --- a/refstack_client/list_parser.py +++ b/refstack_client/list_parser.py @@ -85,10 +85,10 @@ class TestListParser(object): for testcase in test_list: if testcase.startswith("tempest"): # Search for any strings like '[smoke, gate]' in the test ID. - match = re.search('(\[.*\])', testcase) + match = re.search(r'(\[.*\])', testcase) if match: - testcase = re.sub('\[.*\]', '', testcase) + testcase = re.sub(r'\[.*\]', '', testcase) test_mappings[testcase] = match.group(1) else: test_mappings[testcase] = "" @@ -195,16 +195,16 @@ class TestListParser(object): """This takes in a test list file, get normalized, and get whitelist regexes using full qualified test names (one per line). Ex: - 'tempest.test1[id-2,gate]' -> tempest.test1\[ - 'tempest.test2[id-3,smoke](scenario)' -> tempest.test2\[ - 'tempest.test3[compute,id-4]' -> tempest.test3\[ + 'tempest.test1[id-2,gate]' -> tempest.test1\[ # noqa: W605 + 'tempest.test2[id-3,smoke](scenario)' -> tempest.test2\[ # noqa: W605 + 'tempest.test3[compute,id-4]' -> tempest.test3\[ # noqa: W605 :param list_location: file path or URL location of list file """ normalized_list = open(self.get_normalized_test_list(list_location), 'r').read() # Keep the names - tests_list = [re.sub("\[", "\[", test) - for test in re.findall(".*\[", normalized_list)] + tests_list = [re.sub(r"\[", r"\[", test) + for test in re.findall(r".*\[", normalized_list)] return self._write_normalized_test_list(tests_list) diff --git a/refstack_client/refstack_client.py b/refstack_client/refstack_client.py index 21ffce1..fbde4e0 100755 --- a/refstack_client/refstack_client.py +++ b/refstack_client/refstack_client.py @@ -330,7 +330,7 @@ class RefstackClient: raise requests.exceptions.HTTPError(message) # If a Key or Index Error was raised, one of the expected keys or # indices for retrieving the identity service ID was not found. - except (KeyError, IndexError) as e: + except (KeyError, IndexError): self.logger.warning('Unable to retrieve CPID from Keystone %s ' 'catalog. The catalog or the identity ' 'service endpoint was not ' diff --git a/refstack_client/subunit_processor.py b/refstack_client/subunit_processor.py index 7479358..ad3e819 100644 --- a/refstack_client/subunit_processor.py +++ b/refstack_client/subunit_processor.py @@ -50,7 +50,7 @@ class TempestSubunitTestResultPassOnly(testtools.TestResult): # Remove any [] from the test ID before appending it. # Will leave in any () for now as they are the only thing discerning # certain test cases. - test_result = {'name': str(re.sub('\[.*\]', '', testcase.id()))} + test_result = {'name': str(re.sub(r'\[.*\]', '', testcase.id()))} uuid = self.get_test_uuid(str(testcase.id())) if uuid: test_result['uuid'] = uuid diff --git a/refstack_client/tests/unit/test_list_parser.py b/refstack_client/tests/unit/test_list_parser.py index b6b1739..a8f0606 100644 --- a/refstack_client/tests/unit/test_list_parser.py +++ b/refstack_client/tests/unit/test_list_parser.py @@ -181,7 +181,7 @@ class TestTestListParser(unittest.TestCase): expected_list = "tempest.test.one\[\n"\ "tempest.test.two\[\n"\ - "tempest.test.three\[\n" + "tempest.test.three\[\n" # noqa W605 tmpfile = tempfile.mktemp() with open(tmpfile, 'w') as f: diff --git a/test-requirements.txt b/test-requirements.txt index de04df0..39b4325 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,6 @@ pep8==1.4.5 -pyflakes>=0.7.2,<0.8.1 -flake8<3.6.0 +pyflakes>=0.7.2,<2.2.0 +flake8<3.8.0 docutils>=0.11 # OSI-Approved Open Source, Public Domain stestr>=1.1.0 # Apache-2.0 testtools>=0.9.34 diff --git a/tox.ini b/tox.ini index f2aee1d..86311c2 100644 --- a/tox.ini +++ b/tox.ini @@ -46,7 +46,8 @@ commands = sphinx-build -b html doc/source doc/build/html [flake8] # E125 continuation line does not distinguish itself from next logical line # H404 multi line docstring should start with a summary -ignore = E125,H404 +# W504 skipped because it is overeager and unnecessary +ignore = E125,H404,W504 show-source = true builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,build,.tempest