Skip to content

Commit 7929150

Browse files
Merge pull request #804 from hugapi/jtyler/isort-experiment
isort as part of the CI pipeline
2 parents 45ccb9a + f747341 commit 7929150

File tree

7 files changed

+28
-9
lines changed

7 files changed

+28
-9
lines changed

.isort.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[settings]
2+
multi_line_output=3
3+
include_trailing_comma=True
4+
force_grid_wrap=0
5+
use_parentheses=True
6+
line_length=100

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ matrix:
3737
sudo: required
3838
python: 3.7
3939
env: TOXENV=py37-vulture
40+
- os: linux
41+
sudo: required
42+
python: 3.7
43+
env: TOXENV=py37-isort
4044
- os: linux
4145
sudo: required
4246
python: pypy3.5-6.0

hug/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
from falcon import *
3535

3636
from hug import (
37-
authentication,
3837
directives,
3938
exceptions,
4039
format,
@@ -89,11 +88,11 @@
8988
)
9089
from hug.types import create as type
9190

92-
# The following imports must be imported last for defaults to have access to all modules
91+
# The following imports must be imported last; in particular, defaults to have access to all modules
92+
from hug import authentication # isort:skip
9393
from hug import development_runner # isort:skip
9494
from hug import defaults # isort:skip
9595

96-
9796
try: # pragma: no cover - defaulting to uvloop if it is installed
9897
import uvloop
9998
import asyncio

requirements/build_common.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
-r common.txt
22
flake8==3.3.0
3-
isort==4.2.5
43
pytest-cov==2.4.0
54
pytest==4.3.1
65
python-coveralls==2.9.0

requirements/build_style_tools.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-r build_common.txt
22
black==19.3b0
3+
isort==4.3.20
34
pep8-naming==0.8.2
45
flake8-bugbear==19.3.0
56
vulture==1.0
6-
bandit==1.6.0
7+
bandit==1.6.0

tests/test_full_request.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ def post(body, response):
3939
"""
4040

4141

42-
@pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="Can't run hug CLI from travis PyPy")
42+
@pytest.mark.skipif(
43+
platform.python_implementation() == "PyPy", reason="Can't run hug CLI from travis PyPy"
44+
)
4345
def test_hug_post(tmp_path):
44-
hug_test_file = (tmp_path / "hug_postable.py")
46+
hug_test_file = tmp_path / "hug_postable.py"
4547
hug_test_file.write_text(TEST_HUG_API)
46-
hug_server = Popen(['hug', '-f', str(hug_test_file), '-p', '3000'])
48+
hug_server = Popen(["hug", "-f", str(hug_test_file), "-p", "3000"])
4749
time.sleep(5)
48-
requests.post('http://127.0.0.1:3000/test', {'data': 'here'})
50+
requests.post("http://127.0.0.1:3000/test", {"data": "here"})
4951
hug_server.kill()

tox.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ deps=
4343
whitelist_externals=flake8
4444
commands=bandit -r hug/ -ll
4545

46+
[testenv:py37-isort]
47+
deps=
48+
-rrequirements/build_style_tools.txt
49+
marshmallow >=3.0.0rc5
50+
51+
whitelist_externals=flake8
52+
commands=isort -c --diff --recursive hug
53+
4654
[testenv:pywin]
4755
deps =-rrequirements/build_windows.txt
4856
basepython = {env:PYTHON:}\python.exe

0 commit comments

Comments
 (0)