diff --git a/poetry.lock b/poetry.lock index 4a0bb67d..1220b402 100644 --- a/poetry.lock +++ b/poetry.lock @@ -361,14 +361,14 @@ flake8 = ">=3.5,<4.0" [[package]] name = "flake8-bugbear" -version = "19.8.0" +version = "20.1.4" description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle." category = "dev" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" [package.dependencies] -attrs = "*" +attrs = ">=19.2.0" flake8 = ">=3.0.0" [[package]] @@ -423,11 +423,11 @@ pydocstyle = ">=2.1" [[package]] name = "flake8-eradicate" -version = "0.3.0" +version = "0.4.0" description = "Flake8 plugin to find commented out code" category = "dev" optional = false -python-versions = ">=3.6,<4.0" +python-versions = ">=3.5,<4.0" [package.dependencies] attrs = "*" @@ -444,23 +444,20 @@ python-versions = "*" [[package]] name = "flake8-isort" -version = "3.0.1" +version = "4.0.0" description = "flake8 plugin that integrates isort ." category = "dev" optional = false python-versions = "*" [package.extras] -test = ["pytest (>=4.0.2,<6)"] +test = ["pytest (>=4.0.2,<6)", "toml"] [package.dependencies] flake8 = ">=3.2.1,<4" +isort = ">=4.3.5,<6" testfixtures = ">=6.8.0,<7" -[package.dependencies.isort] -version = ">=4.3.5,<5" -extras = ["pyproject"] - [[package]] name = "flake8-polyfill" version = "1.0.2" @@ -474,7 +471,7 @@ flake8 = "*" [[package]] name = "flake8-quotes" -version = "2.1.2" +version = "3.2.0" description = "Flake8 lint for quotes." category = "dev" optional = false @@ -485,7 +482,7 @@ flake8 = "*" [[package]] name = "flake8-rst-docstrings" -version = "0.0.12" +version = "0.0.14" description = "Python docstring reStructuredText (RST) validator" category = "dev" optional = false @@ -497,7 +494,7 @@ restructuredtext_lint = "*" [[package]] name = "flake8-string-format" -version = "0.2.3" +version = "0.3.0" description = "string format checker, plugin for flake8" category = "dev" optional = false @@ -619,17 +616,16 @@ python-versions = "*" [[package]] name = "isort" -version = "4.3.21" +version = "5.5.4" description = "A Python utility / library to sort Python imports." category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.6,<4.0" [package.extras] -pipfile = ["pipreqs", "requirementslib"] -pyproject = ["toml"] -requirements = ["pipreqs", "pip-api"] -xdg_home = ["appdirs (>=1.4.0)"] +pipfile_deprecated_finder = ["pipreqs", "requirementslib"] +requirements_deprecated_finder = ["pipreqs", "pip-api"] +colors = ["colorama (>=0.4.3,<0.5.0)"] [[package]] name = "loguru" @@ -750,7 +746,7 @@ python-versions = ">=2.6" [[package]] name = "pep8-naming" -version = "0.9.1" +version = "0.11.1" description = "Check PEP-8 naming conventions, plugin for flake8" category = "dev" optional = false @@ -1243,36 +1239,41 @@ python-versions = ">=3.6.1" [[package]] name = "wemake-python-styleguide" version = "0.14.1" -description = "The strictest and most opinionated python linter ever" +description = "" category = "dev" optional = false -python-versions = ">=3.6,<4.0" +python-versions = "^3.6" [package.dependencies] -astor = ">=0.8,<0.9" +astor = "^0.8" attrs = "*" -darglint = ">=1.2,<2.0" -flake8 = ">=3.7,<4.0" -flake8-bandit = ">=2.1,<3.0" -flake8-broken-line = ">=0.2,<0.3" -flake8-bugbear = ">=19.3,<20.0" -flake8-commas = ">=2.0,<3.0" -flake8-comprehensions = ">=3.1.0,<4.0.0" -flake8-debugger = ">=3.1,<4.0" -flake8-docstrings = ">=1.3.1,<2.0.0" -flake8-eradicate = ">=0.3,<0.4" -flake8-isort = ">=3.0.1,<4" -flake8-quotes = ">=2.0.1,<3.0.0" -flake8-rst-docstrings = ">=0.0.12,<0.0.13" -flake8-string-format = ">=0.2,<0.3" -pep8-naming = ">=0.9.1,<0.10.0" -pygments = ">=2.4,<3.0" -typing_extensions = ">=3.6,<4.0" +darglint = "^1.2" +flake8 = "^3.7" +flake8-bandit = "^2.1" +flake8-broken-line = "^0.2" +flake8-bugbear = "^20.1" +flake8-commas = "^2.0" +flake8-comprehensions = "^3.1.0" +flake8-debugger = "^3.1" +flake8-docstrings = "^1.3.1" +flake8-eradicate = ">=0.3,<0.5" +flake8-isort = ">=3.0.1,<5.0" +flake8-quotes = "^3.0" +flake8-rst-docstrings = ">=0.0.13,<0.0.15" +flake8-string-format = "^0.3" +pep8-naming = ">=0.10,<0.12" +pygments = "^2.4" +typing_extensions = "^3.6" [package.dependencies.importlib-metadata] version = "*" python = "<3.8" +[package.source] +url = "https://github.com/wemake-services/wemake-python-styleguide" +reference = "a787ee18004f8807401d5b159218d3848cb96306" +type = "git" + [[package]] name = "win32-setctime" version = "1.0.2" @@ -1301,7 +1302,7 @@ testing = ["pytest (>=3.5,<3.7.3 || >3.7.3)", "pytest-checkdocs (>=1.2.3)", "pyt [metadata] lock-version = "1.0" python-versions = "^3.7" -content-hash = "bf208dfbf69389a2827df8f4bec3b7e922b8089e21c87d814e827f5cb47d4d44" +content-hash = "c8c11baa77923b16b84c71b339eb6dcc69779acb88191cc98132a3353467096e" [metadata.files] aiosql = [ @@ -1512,8 +1513,8 @@ flake8-broken-line = [ {file = "flake8_broken_line-0.2.1-py3-none-any.whl", hash = "sha256:75858359e3ccd4f1d92a9e7582aa5c9e4485cbc920dd05954703900cf907667e"}, ] flake8-bugbear = [ - {file = "flake8-bugbear-19.8.0.tar.gz", hash = "sha256:d8c466ea79d5020cb20bf9f11cf349026e09517a42264f313d3f6fddb83e0571"}, - {file = "flake8_bugbear-19.8.0-py35.py36.py37-none-any.whl", hash = "sha256:ded4d282778969b5ab5530ceba7aa1a9f1b86fa7618fc96a19a1d512331640f8"}, + {file = "flake8-bugbear-20.1.4.tar.gz", hash = "sha256:bd02e4b009fb153fe6072c31c52aeab5b133d508095befb2ffcf3b41c4823162"}, + {file = "flake8_bugbear-20.1.4-py36.py37.py38-none-any.whl", hash = "sha256:a3ddc03ec28ba2296fc6f89444d1c946a6b76460f859795b35b77d4920a51b63"}, ] flake8-commas = [ {file = "flake8-commas-2.0.0.tar.gz", hash = "sha256:d3005899466f51380387df7151fb59afec666a0f4f4a2c6a8995b975de0f44b7"}, @@ -1531,30 +1532,30 @@ flake8-docstrings = [ {file = "flake8_docstrings-1.5.0-py2.py3-none-any.whl", hash = "sha256:a256ba91bc52307bef1de59e2a009c3cf61c3d0952dbe035d6ff7208940c2edc"}, ] flake8-eradicate = [ - {file = "flake8-eradicate-0.3.0.tar.gz", hash = "sha256:d0b3d283d85079917acbfe39b9d637385cd82cba3ae3d76c1278c07ddcf0d9b9"}, - {file = "flake8_eradicate-0.3.0-py3-none-any.whl", hash = "sha256:e8b32b32300bfb407fe7ef74667c8d2d3a6a81bdf6f09c14a7bcc82b7b870f8b"}, + {file = "flake8-eradicate-0.4.0.tar.gz", hash = "sha256:be5ea4521dfd4cb76837635f9ace57e12a7336c4b82054c99fd0394c00eef8ce"}, + {file = "flake8_eradicate-0.4.0-py3-none-any.whl", hash = "sha256:804a39aef145c193e8d77770efc45df82e631b29c4456ecb5ff2e2e5996cf09a"}, ] flake8-fixme = [ {file = "flake8-fixme-1.1.1.tar.gz", hash = "sha256:50cade07d27a4c30d4f12351478df87339e67640c83041b664724bda6d16f33a"}, {file = "flake8_fixme-1.1.1-py2.py3-none-any.whl", hash = "sha256:226a6f2ef916730899f29ac140bed5d4a17e5aba79f00a0e3ae1eff1997cb1ac"}, ] flake8-isort = [ - {file = "flake8-isort-3.0.1.tar.gz", hash = "sha256:5d976da513cc390232ad5a9bb54aee8a092466a15f442d91dfc525834bee727a"}, - {file = "flake8_isort-3.0.1-py2.py3-none-any.whl", hash = "sha256:df1dd6dd73f6a8b128c9c783356627231783cccc82c13c6dc343d1a5a491699b"}, + {file = "flake8-isort-4.0.0.tar.gz", hash = "sha256:2b91300f4f1926b396c2c90185844eb1a3d5ec39ea6138832d119da0a208f4d9"}, + {file = "flake8_isort-4.0.0-py2.py3-none-any.whl", hash = "sha256:729cd6ef9ba3659512dee337687c05d79c78e1215fdf921ed67e5fe46cce2f3c"}, ] flake8-polyfill = [ {file = "flake8-polyfill-1.0.2.tar.gz", hash = "sha256:e44b087597f6da52ec6393a709e7108b2905317d0c0b744cdca6208e670d8eda"}, {file = "flake8_polyfill-1.0.2-py2.py3-none-any.whl", hash = "sha256:12be6a34ee3ab795b19ca73505e7b55826d5f6ad7230d31b18e106400169b9e9"}, ] flake8-quotes = [ - {file = "flake8-quotes-2.1.2.tar.gz", hash = "sha256:c844c9592940c8926c60f00bc620808912ff2acd34923ab5338f3a5ca618a331"}, + {file = "flake8-quotes-3.2.0.tar.gz", hash = "sha256:3f1116e985ef437c130431ac92f9b3155f8f652fda7405ac22ffdfd7a9d1055e"}, ] flake8-rst-docstrings = [ - {file = "flake8-rst-docstrings-0.0.12.tar.gz", hash = "sha256:01d38327801781b26c3dfeb71ae37e5a02c5ca1b774a686f63feab8824ca6f9c"}, + {file = "flake8-rst-docstrings-0.0.14.tar.gz", hash = "sha256:8f8bcb18f1408b506dd8ba2c99af3eac6128f6911d4bf6ff874b94caa70182a2"}, ] flake8-string-format = [ - {file = "flake8-string-format-0.2.3.tar.gz", hash = "sha256:774d56103d9242ed968897455ef49b7d6de272000cfa83de5814273a868832f1"}, - {file = "flake8_string_format-0.2.3-py2.py3-none-any.whl", hash = "sha256:68ea72a1a5b75e7018cae44d14f32473c798cf73d75cbaed86c6a9a907b770b2"}, + {file = "flake8-string-format-0.3.0.tar.gz", hash = "sha256:65f3da786a1461ef77fca3780b314edb2853c377f2e35069723348c8917deaa2"}, + {file = "flake8_string_format-0.3.0-py2.py3-none-any.whl", hash = "sha256:812ff431f10576a74c89be4e85b8e075a705be39bc40c4b4278b5b13e2afa9af"}, ] gitdb = [ {file = "gitdb-4.0.5-py3-none-any.whl", hash = "sha256:91f36bfb1ab7949b3b40e23736db18231bf7593edada2ba5c3a174a7b23657ac"}, @@ -1603,8 +1604,8 @@ iniconfig = [ {file = "iniconfig-1.0.1.tar.gz", hash = "sha256:e5f92f89355a67de0595932a6c6c02ab4afddc6fcdc0bfc5becd0d60884d3f69"}, ] isort = [ - {file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"}, - {file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"}, + {file = "isort-5.5.4-py3-none-any.whl", hash = "sha256:36f0c6659b9000597e92618d05b72d4181104cf59472b1c6a039e3783f930c95"}, + {file = "isort-5.5.4.tar.gz", hash = "sha256:ba040c24d20aa302f78f4747df549573ae1eaf8e1084269199154da9c483f07f"}, ] loguru = [ {file = "loguru-0.5.3-py3-none-any.whl", hash = "sha256:f8087ac396b5ee5f67c963b495d615ebbceac2796379599820e324419d53667c"}, @@ -1685,8 +1686,8 @@ pbr = [ {file = "pbr-5.5.0.tar.gz", hash = "sha256:14bfd98f51c78a3dd22a1ef45cf194ad79eee4a19e8e1a0d5c7f8e81ffe182ea"}, ] pep8-naming = [ - {file = "pep8-naming-0.9.1.tar.gz", hash = "sha256:a33d38177056321a167decd6ba70b890856ba5025f0a8eca6a3eda607da93caf"}, - {file = "pep8_naming-0.9.1-py2.py3-none-any.whl", hash = "sha256:45f330db8fcfb0fba57458c77385e288e7a3be1d01e8ea4268263ef677ceea5f"}, + {file = "pep8-naming-0.11.1.tar.gz", hash = "sha256:a1dd47dd243adfe8a83616e27cf03164960b507530f155db94e10b36a6cd6724"}, + {file = "pep8_naming-0.11.1-py2.py3-none-any.whl", hash = "sha256:f43bfe3eea7e0d73e8b5d07d6407ab47f2476ccaeff6937c84275cd30b016738"}, ] pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, @@ -2019,10 +2020,7 @@ websockets = [ {file = "websockets-8.1-cp38-cp38-win_amd64.whl", hash = "sha256:f8a7bff6e8664afc4e6c28b983845c5bc14965030e3fb98789734d416af77c4b"}, {file = "websockets-8.1.tar.gz", hash = "sha256:5c65d2da8c6bce0fca2528f69f44b2f977e06954c8512a952222cea50dad430f"}, ] -wemake-python-styleguide = [ - {file = "wemake-python-styleguide-0.14.1.tar.gz", hash = "sha256:e13dc580fa56b7b548de8da170bccb8ddff2d4ab026ca987db8a9893bf8a7b5b"}, - {file = "wemake_python_styleguide-0.14.1-py3-none-any.whl", hash = "sha256:73a501e0547275287a2b926515c000cc25026a8bceb9dcc1bf73ef85a223a3c6"}, -] +wemake-python-styleguide = [] win32-setctime = [ {file = "win32_setctime-1.0.2-py3-none-any.whl", hash = "sha256:02b4c5959ca0b195f45c98115826c6e8a630b7cf648e724feaab1a5aa6250640"}, {file = "win32_setctime-1.0.2.tar.gz", hash = "sha256:47aa7c43548c1fc0a4f026d1944b748b37036df116c7c4cf908e82638d854313"}, diff --git a/pyproject.toml b/pyproject.toml index 058f2f58..bcae9404 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,9 +23,9 @@ loguru = "^0.5.1" [tool.poetry.dev-dependencies] black = "^20.8b1" -isort = "^4.3" +isort = "^5.0" autoflake = "^1.4" -wemake-python-styleguide = "^0.14.1" +wemake-python-styleguide = { git = "https://github.com/wemake-services/wemake-python-styleguide", rev = "a787ee1" } mypy = "^0.782" flake8-fixme = "^1.1" pytest = "^6.0" @@ -36,6 +36,28 @@ docker = "^4.3" httpx = "^0.14.2" asgi-lifespan = "^1.0.1" +[tool.isort] +profile = "black" +src_paths = ["app", "tests"] +combine_as_imports = true + +[tool.pytest.ini_options] +testpaths = "tests" +filterwarnings = "error" +addopts = ''' + --strict + --tb=short + --cov=app + --cov=tests + --cov-branch + --cov-report=term-missing + --cov-report=html + --cov-report=xml + --no-cov-on-fail + --cov-fail-under=100 +''' +env = ["SECRET_KEY=secret"] + [build-system] requires = ["poetry>=1.0"] build-backend = "poetry.masonry.api" diff --git a/scripts/format b/scripts/format index ea432a25..64a9b14e 100755 --- a/scripts/format +++ b/scripts/format @@ -2,7 +2,7 @@ set -e -isort --recursive --force-single-line-imports app tests +isort --force-single-line-imports app tests autoflake --recursive --remove-all-unused-imports --remove-unused-variables --in-place app tests black app tests -isort --recursive app tests +isort app tests diff --git a/scripts/lint b/scripts/lint index 287f43c5..ea56cfee 100755 --- a/scripts/lint +++ b/scripts/lint @@ -8,4 +8,4 @@ flake8 app --exclude=app/db/migrations mypy app black --check app --diff -isort --recursive --check-only app +isort --check-only app diff --git a/setup.cfg b/setup.cfg index b34809d9..9c6c768e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,3 @@ -[tool:pytest] -testpaths = tests -filterwarnings = error -env = - SECRET_KEY=secret - [coverage:report] precision = 2 exclude_lines = @@ -50,13 +44,6 @@ ignore_missing_imports = True [mypy-pypika.*] ignore_missing_imports = True -[isort] -multi_line_output = 3 -include_trailing_comma = True -line_length = 88 -force_grid_wrap = 0 -combine_as_imports = True - [flake8] format = wemake max-line-length = 88 @@ -88,4 +75,4 @@ ignore = WPS601, no-accept-encodings = True nested-classes-whitelist=Config -inline-quotes = " +inline-quotes = double diff --git a/tests/conftest.py b/tests/conftest.py index e54efb27..48f3dfb3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,13 +3,13 @@ from os import environ, getenv import alembic.config +import docker as libdocker import pytest from asgi_lifespan import LifespanManager from asyncpg.pool import Pool from fastapi import FastAPI from httpx import AsyncClient -import docker as libdocker from app.db.repositories.articles import ArticlesRepository from app.db.repositories.users import UsersRepository from app.models.domain.articles import Article diff --git a/tests/testing_helpers.py b/tests/testing_helpers.py index 01e287c1..95d8ff58 100644 --- a/tests/testing_helpers.py +++ b/tests/testing_helpers.py @@ -2,9 +2,8 @@ from functools import wraps from typing import Any, Callable, Type -import psycopg2 - import docker.errors +import psycopg2 from docker import APIClient