diff --git a/.travis.yml b/.travis.yml index c7bdf56..cf97ffd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,16 +2,15 @@ sudo: false language: python python: - "2.7" - - "3.3" - - "3.4" - "3.5" - "3.6" + - "3.7" + - "3.8" install: - pip install -r requirements.txt script: - pylint src/azure_devtools/scenario_tests - - if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then pylint src/azure_devtools/ci_tools --ignore=tests; fi; # CI tools is Py3.6 only - - pytest --cov=azure_devtools + - pytest --cov=azure_devtools src/azure_devtools/scenario_tests after_success: - codecov deploy: diff --git a/pylintrc b/pylintrc index 01ae42f..890ffa8 100644 --- a/pylintrc +++ b/pylintrc @@ -1,12 +1,19 @@ [MESSAGES CONTROL] # For all codes, run 'pylint --list-msgs' or go to 'http://pylint-messages.wikidot.com/all-codes' -# C0111 Missing docstring +# C0111 Missing docstring # C0103 Invalid %s name "%s" # I0011 Warning locally suppressed using disable-msg # W0511 fixme # R0401 Cyclic import (because of https://github.com/PyCQA/pylint/issues/850) # R0913 Too many arguments - Due to the nature of the CLI many commands have large arguments set which reflect in large arguments set in corresponding methods. -disable=C0111, C0103, W0511 +disable= + bad-option-value, + C0111, + C0103, + W0511, + R0401, + useless-object-inheritance, + import-outside-toplevel [FORMAT] max-line-length=120 @@ -23,4 +30,3 @@ init-import=yes [SIMILARITIES] min-similarity-lines=8 - diff --git a/requirements.txt b/requirements.txt index 7eb8e88..29eddd5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,9 @@ codecov==2.0.9 mock==2.0.0 -pylint==1.8.4 +pylint==2.5.3; python_version > '3' +pylint==1.8.4; python_version < '3' +isort==4.3.21 # https://github.com/PyCQA/pylint/pull/3725 pytest==3.5.1 pytest-cov==2.5.1 --e .[ci_tools] \ No newline at end of file +-e .[ci_tools] diff --git a/src/azure_devtools/scenario_tests/base.py b/src/azure_devtools/scenario_tests/base.py index 81d90f9..6b4fd00 100644 --- a/src/azure_devtools/scenario_tests/base.py +++ b/src/azure_devtools/scenario_tests/base.py @@ -195,7 +195,7 @@ def _process_response_recording(self, response): @classmethod def _custom_request_query_matcher(cls, r1, r2): """ Ensure method, path, and query parameters match. """ - from six.moves.urllib_parse import urlparse, parse_qs # pylint: disable=import-error,relative-import + from six.moves.urllib_parse import urlparse, parse_qs # pylint: disable=import-error, relative-import url1 = urlparse(r1.uri) url2 = urlparse(r2.uri) diff --git a/src/azure_devtools/scenario_tests/preparers.py b/src/azure_devtools/scenario_tests/preparers.py index b10d8c9..593e1b4 100644 --- a/src/azure_devtools/scenario_tests/preparers.py +++ b/src/azure_devtools/scenario_tests/preparers.py @@ -97,7 +97,7 @@ def remove_resource_with_record_override(self, name, **kwargs): class SingleValueReplacer(RecordingProcessor): # pylint: disable=no-member def process_request(self, request): - from six.moves.urllib_parse import quote_plus # pylint: disable=import-error,relative-import + from six.moves.urllib_parse import quote_plus # pylint: disable=import-error, relative-import if self.random_name in request.uri: request.uri = request.uri.replace(self.random_name, self.moniker) elif quote_plus(self.random_name) in request.uri: diff --git a/src/azure_devtools/scenario_tests/recording_processors.py b/src/azure_devtools/scenario_tests/recording_processors.py index b5e82a5..5b58bb8 100644 --- a/src/azure_devtools/scenario_tests/recording_processors.py +++ b/src/azure_devtools/scenario_tests/recording_processors.py @@ -95,8 +95,8 @@ def process_response(self, response): response['body']['string'] = \ "!!! The response body has been omitted from the recording because it is larger " \ - "than {} KB. It will be replaced with blank content of {} bytes while replay. " \ - "{}{}".format(self._max_response_body, length, self.control_flag, length) + "than {max_body} KB. It will be replaced with blank content of {length} bytes while replay. " \ + "{flag}{length}".format(max_body=self._max_response_body, length=length, flag=self.control_flag) return response diff --git a/src/azure_devtools/scenario_tests/tests/test_utilities.py b/src/azure_devtools/scenario_tests/tests/test_utilities.py index 0862ea1..8fa6771 100644 --- a/src/azure_devtools/scenario_tests/tests/test_utilities.py +++ b/src/azure_devtools/scenario_tests/tests/test_utilities.py @@ -17,7 +17,7 @@ def test_create_random_name_default_value(self): self.assertTrue(isinstance(default_generated_name, str)) def test_create_random_name_randomness(self): - self.assertEqual(100, len(set([create_random_name() for _ in range(100)]))) + self.assertEqual(100, len({create_random_name() for _ in range(100)})) def test_create_random_name_customization(self): customized_name = create_random_name(prefix='pauline', length=61) @@ -74,14 +74,14 @@ def test_get_sha1_hash(self): And whistles in his sound. Last scene of all, That ends this strange eventful history, Is second childishness and mere oblivion, -Sans teeth, sans eyes, sans taste, sans everything. +Sans teeth, sans eyes, sans taste, sans everything. William Shakespeare """ f.write(content) f.seek(0) hash_value = get_sha1_hash(f.name) - self.assertEqual('6487bbdbd848686338d729e6076da1a795d1ae747642bf906469c6ccd9e642f9', hash_value) + self.assertEqual('1a9ea462ce80aac3f1cacbdf59d3a630df01b933593a2c53bccc25ecc2569e31', hash_value) def test_text_payload(self): http_entity = mock.MagicMock()