Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isort as part of the CI pipeline #804

Merged
merged 10 commits into from
May 22, 2019
Merged
6 changes: 6 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[settings]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=100
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ matrix:
sudo: required
python: 3.7
env: TOXENV=py37-vulture
- os: linux
sudo: required
python: 3.7
env: TOXENV=py37-isort
- os: linux
sudo: required
python: pypy3.5-6.0
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Ideally, within a virtual environment.

Changelog
=========
### 3.0.0 - TBD
- Added automated code cleaning and linting satisfying [HOPE-8 -- Style Guideline for Hug](https://github.com/hugapi/HOPE/blob/master/all/HOPE-8--Style-Guide-for-Hug-Code.md#hope-8----style-guide-for-hug-code)
- Implemented [HOPE-20 -- The Zen of Hug](https://github.com/hugapi/HOPE/blob/master/all/HOPE-20--The-Zen-of-Hug.md)

### 2.5.4 hotfix - May 19, 2019
- Fix issue #798 - Development runner `TypeError` when executing cli

Expand Down
5 changes: 2 additions & 3 deletions hug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from falcon import *

from hug import (
authentication,
directives,
exceptions,
format,
Expand Down Expand Up @@ -89,11 +88,11 @@
)
from hug.types import create as type

# The following imports must be imported last for defaults to have access to all modules
# The following imports must be imported last; in particular, defaults to have access to all modules
from hug import authentication # isort:skip
from hug import development_runner # isort:skip
from hug import defaults # isort:skip


try: # pragma: no cover - defaulting to uvloop if it is installed
import uvloop
import asyncio
Expand Down
1 change: 0 additions & 1 deletion requirements/build_common.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
-r common.txt
flake8==3.3.0
isort==4.2.5
pytest-cov==2.4.0
pytest==4.3.1
python-coveralls==2.9.0
Expand Down
3 changes: 2 additions & 1 deletion requirements/build_style_tools.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-r build_common.txt
black==19.3b0
isort==4.3.20
pep8-naming==0.8.2
flake8-bugbear==19.3.0
vulture==1.0
bandit==1.6.0
bandit==1.6.0
10 changes: 6 additions & 4 deletions tests/test_full_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ def post(body, response):
"""


@pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="Can't run hug CLI from travis PyPy")
@pytest.mark.skipif(
platform.python_implementation() == "PyPy", reason="Can't run hug CLI from travis PyPy"
)
def test_hug_post(tmp_path):
hug_test_file = (tmp_path / "hug_postable.py")
hug_test_file = tmp_path / "hug_postable.py"
hug_test_file.write_text(TEST_HUG_API)
hug_server = Popen(['hug', '-f', str(hug_test_file), '-p', '3000'])
hug_server = Popen(["hug", "-f", str(hug_test_file), "-p", "3000"])
time.sleep(5)
requests.post('http://127.0.0.1:3000/test', {'data': 'here'})
requests.post("http://127.0.0.1:3000/test", {"data": "here"})
hug_server.kill()
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ deps=
whitelist_externals=flake8
commands=bandit -r hug/ -ll

[testenv:py37-isort]
deps=
-rrequirements/build_style_tools.txt
marshmallow >=3.0.0rc5

whitelist_externals=flake8
commands=isort -c --diff --recursive hug

[testenv:pywin]
deps =-rrequirements/build_windows.txt
basepython = {env:PYTHON:}\python.exe
Expand Down