diff --git a/demos/ajax/test_app.py b/demos/ajax/test_app.py index 1d4de60..926cff9 100644 --- a/demos/ajax/test_app.py +++ b/demos/ajax/test_app.py @@ -3,9 +3,8 @@ import unittest -from app import main - from wheezy.core.comp import json_dumps + from wheezy.http.functional import WSGIClient @@ -14,6 +13,8 @@ class WelcomeTestCase(unittest.TestCase): d = {"name": ["John"]} def setUp(self): + from app import main + self.client = WSGIClient(main) def tearDown(self): diff --git a/demos/guestbook/guestbook.py b/demos/guestbook/guestbook.py index a3b7356..3307964 100644 --- a/demos/guestbook/guestbook.py +++ b/demos/guestbook/guestbook.py @@ -6,6 +6,7 @@ from wheezy.caching.memory import MemoryCache from wheezy.caching.patterns import CacheDependency from wheezy.core.collections import last_item_adapter + from wheezy.http import ( CacheProfile, HTTPResponse, diff --git a/demos/hello/benchmark_helloworld.py b/demos/hello/benchmark_helloworld.py index 2ec766a..1f8ff05 100644 --- a/demos/hello/benchmark_helloworld.py +++ b/demos/hello/benchmark_helloworld.py @@ -1,10 +1,10 @@ """ ``benchmark_hello`` module. """ -from test_helloworld import HelloWorldTestCase - from wheezy.core.benchmark import Benchmark +from test_helloworld import HelloWorldTestCase + class BenchmarkTestCase(HelloWorldTestCase): """""" diff --git a/demos/hello/test_helloworld.py b/demos/hello/test_helloworld.py index b35fe4e..c874b87 100644 --- a/demos/hello/test_helloworld.py +++ b/demos/hello/test_helloworld.py @@ -3,13 +3,13 @@ import unittest -from helloworld import main - from wheezy.http.functional import WSGIClient class HelloWorldTestCase(unittest.TestCase): def setUp(self): + from helloworld import main + self.client = WSGIClient(main) def tearDown(self): diff --git a/demos/oauth2/app.py b/demos/oauth2/app.py index 171a356..780e6f3 100644 --- a/demos/oauth2/app.py +++ b/demos/oauth2/app.py @@ -10,6 +10,7 @@ from wheezy.core.comp import json_loads, urlencode from wheezy.core.httpclient import HTTPClient from wheezy.core.uuid import shrink_uuid + from wheezy.http import ( HTTPResponse, WSGIApplication, diff --git a/demos/wsgi_adapter/wsgi_adapter.py b/demos/wsgi_adapter/wsgi_adapter.py index 79586b3..9b7cc63 100644 --- a/demos/wsgi_adapter/wsgi_adapter.py +++ b/demos/wsgi_adapter/wsgi_adapter.py @@ -8,6 +8,7 @@ from datetime import datetime, timedelta from wheezy.caching import MemoryCache + from wheezy.http import CacheProfile, WSGIApplication, bootstrap_http_defaults from wheezy.http.cache import etag_md5crc32, wsgi_cache from wheezy.http.comp import b diff --git a/requirements/dev-py2.txt b/requirements/dev-py2.txt index 33a28a7..5bbdf79 100644 --- a/requirements/dev-py2.txt +++ b/requirements/dev-py2.txt @@ -5,15 +5,15 @@ # pip-compile --output-file=requirements/dev-py2.txt requirements/dev.in # atomicwrites==1.4.0 # via pytest -attrs==20.1.0 # via pytest +attrs==20.2.0 # via pytest backports.functools-lru-cache==1.6.1 # via wcwidth click==7.1.2 # via pip-tools colorama==0.4.3 # via pytest configparser==4.0.2 # via importlib-metadata contextlib2==0.6.0.post1 # via importlib-metadata -coverage==5.2.1 # via pytest-cov +coverage==5.3 # via pytest-cov funcsigs==1.0.2 # via mock, pytest -importlib-metadata==1.7.0 # via pluggy, pytest +importlib-metadata==2.0.0 # via pluggy, pytest lxml==4.5.2 # via -r requirements/dev.in mock==3.0.5 # via -r requirements/dev.in more-itertools==5.0.0 # via pytest @@ -28,8 +28,8 @@ pytest==4.6.11 # via -r requirements/dev.in, pytest-cov scandir==1.10.0 # via pathlib2 six==1.15.0 # via mock, more-itertools, packaging, pathlib2, pip-tools, pytest wcwidth==0.2.5 # via pytest -wheezy.caching==0.1.131 # via -r requirements/dev.in -wheezy.core==0.1.153 # via -r requirements/dev.in +wheezy.caching==0.1.133 # via -r requirements/dev.in +wheezy.core==0.1.156 # via -r requirements/dev.in zipp==1.2.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/dev-py3.txt b/requirements/dev-py3.txt index d313ac0..9da881b 100644 --- a/requirements/dev-py3.txt +++ b/requirements/dev-py3.txt @@ -5,25 +5,24 @@ # pip-compile --output-file=requirements/dev-py3.txt requirements/dev.in # atomicwrites==1.4.0 # via pytest -attrs==20.1.0 # via pytest +attrs==20.2.0 # via pytest click==7.1.2 # via pip-tools colorama==0.4.3 # via pytest -coverage==5.2.1 # via pytest-cov +coverage==5.3 # via pytest-cov iniconfig==1.0.1 # via pytest lxml==4.5.2; platform_system != 'Windows' # via -r requirements/dev.in mock==4.0.2 # via -r requirements/dev.in -more-itertools==8.5.0 # via pytest packaging==20.4 # via pytest pip-tools==5.3.1 # via -r requirements/dev.in pluggy==0.13.1 # via pytest py==1.9.0 # via pytest pyparsing==2.4.7 # via packaging pytest-cov==2.10.1 # via -r requirements/dev.in -pytest==6.0.1 # via -r requirements/dev.in, pytest-cov +pytest==6.1.1 # via -r requirements/dev.in, pytest-cov six==1.15.0 # via packaging, pip-tools toml==0.10.1 # via pytest -wheezy.caching==0.1.131 # via -r requirements/dev.in -wheezy.core==0.1.153 # via -r requirements/dev.in +wheezy.caching==0.1.133 # via -r requirements/dev.in +wheezy.core==0.1.156 # via -r requirements/dev.in # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/docs.txt b/requirements/docs.txt index 053f7a2..0afc43b 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -15,7 +15,7 @@ imagesize==1.2.0 # via sphinx jinja2==2.11.2 # via sphinx markupsafe==1.1.1 # via jinja2 packaging==20.4 # via sphinx -pygments==2.6.1 # via sphinx +pygments==2.7.1 # via sphinx pyparsing==2.4.7 # via packaging pytz==2020.1 # via babel requests==2.24.0 # via sphinx @@ -30,7 +30,7 @@ sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.4 # via sphinx urllib3==1.25.10 # via requests -wheezy.core==0.1.153 # via -r requirements/docs.in +wheezy.core==0.1.156 # via -r requirements/docs.in # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/src/wheezy/http/authorization.py b/src/wheezy/http/authorization.py index 951eb68..df2d066 100644 --- a/src/wheezy/http/authorization.py +++ b/src/wheezy/http/authorization.py @@ -2,6 +2,7 @@ """ from wheezy.core.url import UrlParts + from wheezy.http.response import permanent_redirect diff --git a/src/wheezy/http/cacheprofile.py b/src/wheezy/http/cacheprofile.py index 17a0837..865af59 100644 --- a/src/wheezy/http/cacheprofile.py +++ b/src/wheezy/http/cacheprofile.py @@ -5,6 +5,7 @@ from time import time from wheezy.core.datetime import format_http_datetime, total_seconds + from wheezy.http.cachepolicy import HTTPCachePolicy CACHEABILITY = { diff --git a/src/wheezy/http/cookie.py b/src/wheezy/http/cookie.py index 2def6b9..cf2e820 100644 --- a/src/wheezy/http/cookie.py +++ b/src/wheezy/http/cookie.py @@ -5,6 +5,7 @@ from time import time from wheezy.core.datetime import format_http_datetime + from wheezy.http.comp import n diff --git a/src/wheezy/http/functional.py b/src/wheezy/http/functional.py index 899bec0..4256a2a 100644 --- a/src/wheezy/http/functional.py +++ b/src/wheezy/http/functional.py @@ -5,6 +5,7 @@ from wheezy.core.benchmark import Benchmark, Timer from wheezy.core.collections import attrdict, defaultdict from wheezy.core.comp import json_loads, urlsplit + from wheezy.http.comp import ( # noqa: I101 PY3, BytesIO, diff --git a/src/wheezy/http/middleware.py b/src/wheezy/http/middleware.py index 7a2beeb..65143c1 100644 --- a/src/wheezy/http/middleware.py +++ b/src/wheezy/http/middleware.py @@ -2,6 +2,7 @@ """ from wheezy.core.datetime import parse_http_datetime + from wheezy.http.cache import ( CacheableResponse, NotModifiedResponse, diff --git a/src/wheezy/http/request.py b/src/wheezy/http/request.py index 0efe4fd..024801e 100644 --- a/src/wheezy/http/request.py +++ b/src/wheezy/http/request.py @@ -4,6 +4,7 @@ from wheezy.core.comp import json_loads from wheezy.core.descriptors import attribute from wheezy.core.url import UrlParts + from wheezy.http.comp import bton from wheezy.http.parse import parse_cookie, parse_multipart, parse_qs diff --git a/src/wheezy/http/tests/test_cachepolicy.py b/src/wheezy/http/tests/test_cachepolicy.py index 38e0466..a342c00 100644 --- a/src/wheezy/http/tests/test_cachepolicy.py +++ b/src/wheezy/http/tests/test_cachepolicy.py @@ -268,6 +268,7 @@ def test_expires(self): from datetime import datetime from wheezy.core.datetime import UTC + from wheezy.http.cachepolicy import HTTPCachePolicy when = datetime(2012, 4, 13, 14, 57, tzinfo=UTC) @@ -289,6 +290,7 @@ def test_last_modified(self): from datetime import datetime from wheezy.core.datetime import UTC + from wheezy.http.cachepolicy import HTTPCachePolicy when = datetime(2012, 4, 13, 15, 2, tzinfo=UTC) diff --git a/src/wheezy/http/tests/test_cacheprofile.py b/src/wheezy/http/tests/test_cacheprofile.py index 819ba2e..959e8e2 100644 --- a/src/wheezy/http/tests/test_cacheprofile.py +++ b/src/wheezy/http/tests/test_cacheprofile.py @@ -114,6 +114,7 @@ def test_location_client(self): from datetime import datetime, timedelta from wheezy.core.datetime import parse_http_datetime + from wheezy.http.cacheprofile import CacheProfile profile = CacheProfile("client", duration=100) @@ -139,6 +140,7 @@ def test_location_both(self): from datetime import datetime, timedelta from wheezy.core.datetime import parse_http_datetime + from wheezy.http.cacheprofile import CacheProfile profile = CacheProfile("both", duration=100, http_vary=["Cookie"]) @@ -165,6 +167,7 @@ def test_location_public(self): from datetime import datetime, timedelta from wheezy.core.datetime import parse_http_datetime + from wheezy.http.cacheprofile import CacheProfile profile = CacheProfile("public", duration=100) diff --git a/src/wheezy/http/tests/test_cookie.py b/src/wheezy/http/tests/test_cookie.py index 2cc528e..7d1c47d 100644 --- a/src/wheezy/http/tests/test_cookie.py +++ b/src/wheezy/http/tests/test_cookie.py @@ -43,6 +43,7 @@ def test_max_age(self): from datetime import datetime, timedelta from wheezy.core.datetime import parse_http_datetime + from wheezy.http.cookie import HTTPCookie cookie = HTTPCookie("x", max_age=100, options=self.options) diff --git a/tox.ini b/tox.ini index ed35bb5..5465624 100644 --- a/tox.ini +++ b/tox.ini @@ -29,7 +29,7 @@ deps = commands = autoflake --in-place --remove-unused-variables --remove-all-unused-imports \ --recursive src/ demos/ setup.py - isort --profile black --combine-as --case-sensitive demos/ src/ setup.py + isort demos/ src/ setup.py black -ql79 src/ demos/ setup.py flake8 demos doc src setup.py @@ -37,14 +37,21 @@ commands = deps = -r requirements/docs.txt commands = sphinx-build -a -b html doc/ doc/_build/ +[isort] +case_sensitive = true +known_local_folder = test_helloworld +known_third_party = wheezy.core +line_length = 79 +profile = black + [flake8] show-source = True max-complexity = 13 # Codes: https://www.flake8rules.com/ ignore = - # Imported names are in the wrong order. - I101 + # Import statements are in the wrong order. + I100 + # Additional newline in a group of imports. + I202 # line break before binary operator W503 - # line break after binary operator - W504