Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 9 additions & 3 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,4 +30,3 @@ init-import=yes

[SIMILARITIES]
min-similarity-lines=8

6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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]
-e .[ci_tools]
2 changes: 1 addition & 1 deletion src/azure_devtools/scenario_tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/azure_devtools/scenario_tests/preparers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/azure_devtools/scenario_tests/recording_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
6 changes: 3 additions & 3 deletions src/azure_devtools/scenario_tests/tests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down