1
0
mirror of https://github.com/httpie/cli.git synced 2024-12-02 08:52:00 +02:00

Merge pull request #493 from medecau/codestyle_environment

Codestyle environment
This commit is contained in:
Jakub Roztočil 2016-07-29 23:17:00 +02:00 committed by GitHub
commit ee375b6942
5 changed files with 28 additions and 6 deletions

View File

@ -45,6 +45,11 @@ matrix:
- TOXENV=py35
- BREW_INSTALL=python3
# Python Codestyle
- os: linux
python: 3.5
env: CODESTYLE=true
install:
- |
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
@ -54,11 +59,20 @@ install:
fi
sudo pip install tox
fi
if [[ $CODESTYLE ]]; then
pip install pycodestyle
fi
script:
- |
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then
make
if [[ $CODESTYLE ]]; then
# 241 - multiple spaces after ‘,’
# 501 - line too long
pycodestyle --ignore=E241,E501
else
make
fi
else
PATH="/usr/local/bin:$PATH" tox -e "$TOXENV"
fi

View File

@ -213,7 +213,7 @@ output_processing.add_argument(
""".format(
default=DEFAULT_STYLE,
available='\n'.join(
'{0}{1}'.format(8*' ', line.strip())
'{0}{1}'.format(8 * ' ', line.strip())
for line in wrap(', '.join(sorted(AVAILABLE_STYLES)), 60)
).rstrip(),
)

View File

@ -243,7 +243,7 @@ def main(args=sys.argv[1:], env=Environment(), custom_log_error=None):
except requests.TooManyRedirects:
exit_status = ExitStatus.ERROR_TOO_MANY_REDIRECTS
log_error('Too many redirects (--max-redirects=%s).',
parsed_args.max_redirects)
parsed_args.max_redirects)
except Exception as e:
# TODO: Further distinction between expected and unexpected errors.
msg = str(e)

View File

@ -108,8 +108,8 @@ class TestItemParsing:
# Parsed file fields
assert 'file' in items.files
assert (items.files['file'][1].read().strip().decode('utf8')
== FILE_CONTENT)
assert (items.files['file'][1].read().strip().
decode('utf8') == FILE_CONTENT)
def test_multiple_file_fields_with_same_field_name(self):
items = input.parse_items([

10
tox.ini
View File

@ -3,7 +3,7 @@
[tox]
envlist = py26, py27, py35, pypy
envlist = py26, py27, py35, pypy, codestyle
[testenv]
@ -20,3 +20,11 @@ commands =
--verbose \
--doctest-modules \
{posargs:./httpie ./tests}
[testenv:codestyle]
deps = pycodestyle
commands =
pycodestyle \
--ignore=E241,E501
# 241 - multiple spaces after ‘,’
# 501 - line too long