From 896d3b1d53ee578e749e1cb30f9d481642c75872 Mon Sep 17 00:00:00 2001 From: Camila Maia Date: Tue, 6 Oct 2020 10:53:02 -0300 Subject: [PATCH 01/30] Bump scanapi version on Dockerfile --- Dockerfile | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b0ff205d..8dd30347 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ENV PATH="~/.local/bin:${PATH}" RUN pip install pip setuptools --upgrade -RUN pip install scanapi==2.0.0 +RUN pip install scanapi==2.1.0 COPY . /app diff --git a/pyproject.toml b/pyproject.toml index e7f6367f..660ccfec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "scanapi" -version = "2.1.0" +version = "2.1.0-rc.1" description = "Automated Testing and Documentation for your REST API" authors = ["Camila Maia "] license = "MIT" From 35724ec46c740677cdee9343be28ff0251ef1881 Mon Sep 17 00:00:00 2001 From: Marcus Pereira Date: Wed, 7 Oct 2020 18:42:20 -0300 Subject: [PATCH 02/30] add poetry-dynamic-versioning to publish-to-test-pypi (#287) Add poetry-dynamic-versioning o publish-to-test-pypi --- .github/workflows/publish-to-test-pypi.yml | 12 ++ Makefile | 3 + poetry.lock | 165 ++++++++++++--------- pyproject.toml | 10 +- scanapi/__version__.py | 1 + 5 files changed, 123 insertions(+), 68 deletions(-) create mode 100644 scanapi/__version__.py diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index aac8c98e..99349151 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -8,6 +8,18 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Install poetry-dynamic-versioning + run: | + pip install poetry-dynamic-versioning==0.9.0 + make change-version - name: Build and publish to test pypi uses: JRubics/poetry-publish@v1.2 with: diff --git a/Makefile b/Makefile index 511dde09..4c9cbd20 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,9 @@ test: check: @black -l 80 --check . --exclude=.venv +change-version: + @poetry-dynamic-versioning + format: @black -l 80 . --exclude=.venv diff --git a/poetry.lock b/poetry.lock index 35b473cb..c2358263 100644 --- a/poetry.lock +++ b/poetry.lock @@ -21,6 +21,7 @@ description = "Atomic file writes." category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +marker = "sys_platform == \"win32\"" [[package]] name = "attrs" @@ -31,10 +32,10 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [package.extras] -dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "sphinx", "sphinx-rtd-theme", "pre-commit"] +dev = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "sphinx", "sphinx-rtd-theme", "pre-commit"] docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"] -tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] -tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"] +tests = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] +tests_no_zope = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"] [[package]] name = "babel" @@ -56,7 +57,7 @@ optional = false python-versions = "*" [package.dependencies] -colorama = {version = ">=0.3.9", markers = "platform_system == \"Windows\""} +colorama = ">=0.3.9" GitPython = ">=1.0.1" PyYAML = ">=3.13" six = ">=1.10.0" @@ -70,6 +71,9 @@ category = "dev" optional = false python-versions = ">=3.6" +[package.extras] +d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] + [package.dependencies] appdirs = "*" attrs = ">=18.1.0" @@ -79,9 +83,6 @@ regex = "*" toml = ">=0.9.4" typed-ast = ">=1.4.0" -[package.extras] -d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] - [[package]] name = "certifi" version = "2020.6.20" @@ -133,6 +134,7 @@ description = "Cross-platform colored terminal text." category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +marker = "sys_platform == \"win32\" or platform_system == \"Windows\"" [[package]] name = "coverage" @@ -242,19 +244,20 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "importlib-metadata" -version = "1.7.0" +version = "2.0.0" description = "Read metadata from Python packages" category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" - -[package.dependencies] -zipp = ">=0.5" +marker = "python_version < \"3.8\"" [package.extras] docs = ["sphinx", "rst.linker"] testing = ["packaging", "pep517", "importlib-resources (>=1.3)"] +[package.dependencies] +zipp = ">=0.5" + [[package]] name = "importlib-resources" version = "3.0.0" @@ -262,13 +265,16 @@ description = "Read resources from Python packages" category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" - -[package.dependencies] -zipp = {version = ">=0.4", markers = "python_version < \"3.8\""} +marker = "python_version < \"3.7\"" [package.extras] docs = ["sphinx", "rst.linker", "jaraco.packaging"] +[package.dependencies] +[package.dependencies.zipp] +version = ">=0.4" +python = "<3.8" + [[package]] name = "iniconfig" version = "1.0.1" @@ -298,12 +304,12 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -[package.dependencies] -MarkupSafe = ">=0.23" - [package.extras] i18n = ["Babel (>=0.8)"] +[package.dependencies] +MarkupSafe = ">=0.23" + [[package]] name = "markupsafe" version = "1.1.1" @@ -356,12 +362,14 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - [package.extras] dev = ["pre-commit", "tox"] +[package.dependencies] +[package.dependencies.importlib-metadata] +version = ">=0.12" +python = "<3.8" + [[package]] name = "pre-commit" version = "2.6.0" @@ -373,13 +381,19 @@ python-versions = ">=3.6.1" [package.dependencies] cfgv = ">=2.0.0" identify = ">=1.0.0" -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} -importlib-resources = {version = "*", markers = "python_version < \"3.7\""} nodeenv = ">=0.11.1" pyyaml = ">=5.1" toml = "*" virtualenv = ">=20.0.8" +[package.dependencies.importlib-metadata] +version = "*" +python = "<3.8" + +[package.dependencies.importlib-resources] +version = "*" +python = "<3.7" + [[package]] name = "py" version = "1.9.0" @@ -412,20 +426,23 @@ category = "dev" optional = false python-versions = ">=3.5" +[package.extras] +checkqa_mypy = ["mypy (0.780)"] +testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] + [package.dependencies] -atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} +atomicwrites = ">=1.0" attrs = ">=17.4.0" -colorama = {version = "*", markers = "sys_platform == \"win32\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +colorama = "*" iniconfig = "*" packaging = "*" pluggy = ">=0.12,<1.0" py = ">=1.8.2" toml = "*" -[package.extras] -checkqa_mypy = ["mypy (0.780)"] -testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] +[package.dependencies.importlib-metadata] +version = ">=0.12" +python = "<3.8" [[package]] name = "pytest-cov" @@ -435,13 +452,13 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +[package.extras] +testing = ["fields", "hunter", "process-tests (2.0.2)", "six", "pytest-xdist", "virtualenv"] + [package.dependencies] coverage = ">=4.4" pytest = ">=4.6" -[package.extras] -testing = ["fields", "hunter", "process-tests (2.0.2)", "six", "pytest-xdist", "virtualenv"] - [[package]] name = "pytest-freezegun" version = "0.4.1" @@ -462,12 +479,12 @@ category = "dev" optional = false python-versions = ">=3.5" -[package.dependencies] -pytest = ">=2.7" - [package.extras] dev = ["pre-commit", "tox", "pytest-asyncio"] +[package.dependencies] +pytest = ">=2.7" + [[package]] name = "python-dateutil" version = "2.8.1" @@ -511,16 +528,16 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +[package.extras] +security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] +socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"] + [package.dependencies] certifi = ">=2017.4.17" chardet = ">=3.0.2,<4" idna = ">=2.5,<3" urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26" -[package.extras] -security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] -socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"] - [[package]] name = "requests-mock" version = "1.8.0" @@ -529,14 +546,14 @@ category = "dev" optional = false python-versions = "*" -[package.dependencies] -requests = ">=2.3,<3" -six = "*" - [package.extras] fixture = ["fixtures"] test = ["fixtures", "mock", "purl", "pytest", "sphinx", "testrepository (>=0.0.18)", "testtools"] +[package.dependencies] +requests = ">=2.3,<3" +six = "*" + [[package]] name = "six" version = "1.15.0" @@ -569,16 +586,22 @@ category = "dev" optional = false python-versions = ">=3.5" +[package.extras] +docs = ["sphinxcontrib-websupport"] +lint = ["flake8 (>=3.5.0)", "flake8-import-order", "mypy (>=0.780)", "docutils-stubs"] +test = ["pytest", "pytest-cov", "html5lib", "typed-ast", "cython"] + [package.dependencies] alabaster = ">=0.7,<0.8" babel = ">=1.3" -colorama = {version = ">=0.3.5", markers = "sys_platform == \"win32\""} +colorama = ">=0.3.5" docutils = ">=0.12" imagesize = "*" Jinja2 = ">=2.3" packaging = "*" Pygments = ">=2.0" requests = ">=2.5.0" +setuptools = "*" snowballstemmer = ">=1.1" sphinxcontrib-applehelp = "*" sphinxcontrib-devhelp = "*" @@ -587,11 +610,6 @@ sphinxcontrib-jsmath = "*" sphinxcontrib-qthelp = "*" sphinxcontrib-serializinghtml = "*" -[package.extras] -docs = ["sphinxcontrib-websupport"] -lint = ["flake8 (>=3.5.0)", "flake8-import-order", "mypy (>=0.780)", "docutils-stubs"] -test = ["pytest", "pytest-cov", "html5lib", "typed-ast", "cython"] - [[package]] name = "sphinx-rtd-theme" version = "0.5.0" @@ -600,12 +618,12 @@ category = "dev" optional = false python-versions = "*" -[package.dependencies] -sphinx = "*" - [package.extras] dev = ["transifex-client", "sphinxcontrib-httpdomain", "bump2version"] +[package.dependencies] +sphinx = "*" + [[package]] name = "sphinxcontrib-applehelp" version = "1.0.2" @@ -686,9 +704,12 @@ optional = false python-versions = ">=3.6" [package.dependencies] -importlib-metadata = {version = ">=1.7.0", markers = "python_version < \"3.8\""} pbr = ">=2.0.0,<2.1.0 || >2.1.0" +[package.dependencies.importlib-metadata] +version = ">=1.7.0" +python = "<3.8" + [[package]] name = "toml" version = "0.10.1" @@ -720,38 +741,44 @@ socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"] [[package]] name = "virtualenv" -version = "20.0.31" +version = "20.0.33" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" +[package.extras] +docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"] +testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "pytest-xdist (>=1.31.0)", "packaging (>=20.0)", "xonsh (>=0.9.16)"] + [package.dependencies] appdirs = ">=1.4.3,<2" distlib = ">=0.3.1,<1" filelock = ">=3.0.0,<4" -importlib-metadata = {version = ">=0.12,<2", markers = "python_version < \"3.8\""} -importlib-resources = {version = ">=1.0", markers = "python_version < \"3.7\""} six = ">=1.9.0,<2" -[package.extras] -docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"] -testing = ["coverage (>=5)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "pytest-xdist (>=1.31.0)", "packaging (>=20.0)", "xonsh (>=0.9.16)"] +[package.dependencies.importlib-metadata] +version = ">=0.12,<3" +python = "<3.8" + +[package.dependencies.importlib-resources] +version = ">=1.0" +python = "<3.7" [[package]] name = "zipp" -version = "3.2.0" +version = "3.3.0" description = "Backport of pathlib-compatible object wrapper for zip files" category = "dev" optional = false python-versions = ">=3.6" +marker = "python_version < \"3.8\"" [package.extras] docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["pytest (>=3.5,<3.7.3 || >3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] [metadata] -lock-version = "1.1" python-versions = "^3.6.1" content-hash = "bc762abd4cbdffe6274e4a976bf208824e3585e43e1308c5663d6de57064844f" @@ -885,8 +912,8 @@ imagesize = [ {file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"}, ] importlib-metadata = [ - {file = "importlib_metadata-1.7.0-py2.py3-none-any.whl", hash = "sha256:dc15b2969b4ce36305c51eebe62d418ac7791e9a157911d58bfb1f9ccd8e2070"}, - {file = "importlib_metadata-1.7.0.tar.gz", hash = "sha256:90bb658cdbbf6d1735b6341ce708fc7024a3e14e99ffdc5783edea9f9b077f83"}, + {file = "importlib_metadata-2.0.0-py2.py3-none-any.whl", hash = "sha256:cefa1a2f919b866c5beb7c9f7b0ebb4061f30a8a9bf16d609b000e2dfaceb9c3"}, + {file = "importlib_metadata-2.0.0.tar.gz", hash = "sha256:77a540690e24b0305878c37ffd421785a6f7e53c8b5720d211b211de8d0e95da"}, ] importlib-resources = [ {file = "importlib_resources-3.0.0-py2.py3-none-any.whl", hash = "sha256:d028f66b66c0d5732dae86ba4276999855e162a749c92620a38c1d779ed138a7"}, @@ -1033,6 +1060,12 @@ regex = [ {file = "regex-2020.9.27-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:8d69cef61fa50c8133382e61fd97439de1ae623fe943578e477e76a9d9471637"}, {file = "regex-2020.9.27-cp38-cp38-win32.whl", hash = "sha256:f2388013e68e750eaa16ccbea62d4130180c26abb1d8e5d584b9baf69672b30f"}, {file = "regex-2020.9.27-cp38-cp38-win_amd64.whl", hash = "sha256:4318d56bccfe7d43e5addb272406ade7a2274da4b70eb15922a071c58ab0108c"}, + {file = "regex-2020.9.27-cp39-cp39-manylinux1_i686.whl", hash = "sha256:84cada8effefe9a9f53f9b0d2ba9b7b6f5edf8d2155f9fdbe34616e06ececf81"}, + {file = "regex-2020.9.27-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:816064fc915796ea1f26966163f6845de5af78923dfcecf6551e095f00983650"}, + {file = "regex-2020.9.27-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:5d892a4f1c999834eaa3c32bc9e8b976c5825116cde553928c4c8e7e48ebda67"}, + {file = "regex-2020.9.27-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:c9443124c67b1515e4fe0bb0aa18df640965e1030f468a2a5dc2589b26d130ad"}, + {file = "regex-2020.9.27-cp39-cp39-win32.whl", hash = "sha256:49f23ebd5ac073765ecbcf046edc10d63dcab2f4ae2bce160982cb30df0c0302"}, + {file = "regex-2020.9.27-cp39-cp39-win_amd64.whl", hash = "sha256:3d20024a70b97b4f9546696cbf2fd30bae5f42229fbddf8661261b1eaff0deb7"}, {file = "regex-2020.9.27.tar.gz", hash = "sha256:a6f32aea4260dfe0e55dc9733ea162ea38f0ea86aa7d0f77b15beac5bf7b369d"}, ] requests = [ @@ -1123,10 +1156,10 @@ urllib3 = [ {file = "urllib3-1.25.10.tar.gz", hash = "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a"}, ] virtualenv = [ - {file = "virtualenv-20.0.31-py2.py3-none-any.whl", hash = "sha256:e0305af10299a7fb0d69393d8f04cb2965dda9351140d11ac8db4e5e3970451b"}, - {file = "virtualenv-20.0.31.tar.gz", hash = "sha256:43add625c53c596d38f971a465553f6318decc39d98512bc100fa1b1e839c8dc"}, + {file = "virtualenv-20.0.33-py2.py3-none-any.whl", hash = "sha256:35ecdeb58cfc2147bb0706f7cdef69a8f34f1b81b6d49568174e277932908b8f"}, + {file = "virtualenv-20.0.33.tar.gz", hash = "sha256:a5e0d253fe138097c6559c906c528647254f437d1019af9d5a477b09bfa7300f"}, ] zipp = [ - {file = "zipp-3.2.0-py3-none-any.whl", hash = "sha256:43f4fa8d8bb313e65d8323a3952ef8756bf40f9a5c3ea7334be23ee4ec8278b6"}, - {file = "zipp-3.2.0.tar.gz", hash = "sha256:b52f22895f4cfce194bc8172f3819ee8de7540aa6d873535a8668b730b8b411f"}, + {file = "zipp-3.3.0-py3-none-any.whl", hash = "sha256:eed8ec0b8d1416b2ca33516a37a08892442f3954dee131e92cfd92d8fe3e7066"}, + {file = "zipp-3.3.0.tar.gz", hash = "sha256:64ad89efee774d1897a58607895d80789c59778ea02185dd846ac38394a8642b"}, ] diff --git a/pyproject.toml b/pyproject.toml index 660ccfec..15d652e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "scanapi" -version = "2.1.0-rc.1" +version = "2.1.0" description = "Automated Testing and Documentation for your REST API" authors = ["Camila Maia "] license = "MIT" @@ -36,6 +36,12 @@ pre-commit = "2.6.0" isort = "^5.5.3" bandit = "^1.6.2" +[tool.poetry-dynamic-versioning] +enable = true +vcs = "git" +style = "semver" +latest-tag = true + [tool.isort] multi_line_output = 3 include_trailing_comma = true @@ -44,5 +50,5 @@ include_trailing_comma = true addopts="-svvl" [build-system] -requires = ["poetry>=1.0.9"] +requires = ["poetry>=1.0.9", "poetry-dynamic-versioning"] build-backend = "poetry.masonry.api" diff --git a/scanapi/__version__.py b/scanapi/__version__.py new file mode 100644 index 00000000..9aa3f903 --- /dev/null +++ b/scanapi/__version__.py @@ -0,0 +1 @@ +__version__ = "2.1.0" From 1000e52f7e3b96f3392910b405b23b2ddcb0721e Mon Sep 17 00:00:00 2001 From: Marcus Pereira Date: Thu, 8 Oct 2020 12:18:50 -0300 Subject: [PATCH 03/30] update gitignore (#305) --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 70b489f9..73f397e5 100644 --- a/.gitignore +++ b/.gitignore @@ -630,3 +630,5 @@ MigrationBackup/ # End of https://www.gitignore.io/api/macos,python,visualstudio,visualstudiocode +scanapi-report.html +scanapi.yaml \ No newline at end of file From 7beba90e17c473786fcf23985544c1208c649f1b Mon Sep 17 00:00:00 2001 From: Marcus Pereira Date: Thu, 8 Oct 2020 14:17:00 -0300 Subject: [PATCH 04/30] Fix publish test pypi (#307) Fix Publish to Test PyPI Action --- .github/workflows/publish-to-test-pypi.yml | 15 +++++---------- Makefile | 6 ++++-- pyproject.toml | 6 ------ scanapi/__version__.py | 1 - 4 files changed, 9 insertions(+), 19 deletions(-) delete mode 100644 scanapi/__version__.py diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 99349151..665af970 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -8,17 +8,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - name: Set up Python - uses: actions/setup-python@v2 + - name: Poetry Setup + uses: dschep/install-poetry-action@v1.3 with: - python-version: "3.x" - - name: Install dependencies + version: 1.1.1 + - name: Run poetry pre-release run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Install poetry-dynamic-versioning - run: | - pip install poetry-dynamic-versioning==0.9.0 make change-version - name: Build and publish to test pypi uses: JRubics/poetry-publish@v1.2 @@ -27,4 +22,4 @@ jobs: poetry_version: ">=0.12" pypi_token: ${{ secrets.TEST_PYPI_TOKEN }} repository_name: "testpypi" - repository_url: "https://test.pypi.org/legacy/" + repository_url: "https://test.pypi.org/legacy/" \ No newline at end of file diff --git a/Makefile b/Makefile index 4c9cbd20..9b434b94 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -.PHONY: test format check install sh run +timestamp = `date +%s` + test: @pytest --cov=./scanapi --cov-report=xml @@ -7,7 +8,7 @@ check: @black -l 80 --check . --exclude=.venv change-version: - @poetry-dynamic-versioning + @poetry version 2.1.0-$(timestamp) format: @black -l 80 . --exclude=.venv @@ -25,3 +26,4 @@ run: bandit: @bandit -r scanapi +.PHONY: test format check install sh run diff --git a/pyproject.toml b/pyproject.toml index 15d652e9..22c5e2b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,12 +36,6 @@ pre-commit = "2.6.0" isort = "^5.5.3" bandit = "^1.6.2" -[tool.poetry-dynamic-versioning] -enable = true -vcs = "git" -style = "semver" -latest-tag = true - [tool.isort] multi_line_output = 3 include_trailing_comma = true diff --git a/scanapi/__version__.py b/scanapi/__version__.py deleted file mode 100644 index 9aa3f903..00000000 --- a/scanapi/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "2.1.0" From e3defeb574734518ea657947918c2b72a4446f6d Mon Sep 17 00:00:00 2001 From: Camila Maia Date: Thu, 15 Oct 2020 20:02:06 -0300 Subject: [PATCH 05/30] Revert "Fix publish test pypi (#307)" This reverts commit 7beba90e17c473786fcf23985544c1208c649f1b. --- .github/workflows/publish-to-test-pypi.yml | 15 ++++++++++----- Makefile | 6 ++---- pyproject.toml | 6 ++++++ scanapi/__version__.py | 1 + 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 scanapi/__version__.py diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 665af970..99349151 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -8,12 +8,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - name: Poetry Setup - uses: dschep/install-poetry-action@v1.3 + - name: Set up Python + uses: actions/setup-python@v2 with: - version: 1.1.1 - - name: Run poetry pre-release + python-version: "3.x" + - name: Install dependencies run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Install poetry-dynamic-versioning + run: | + pip install poetry-dynamic-versioning==0.9.0 make change-version - name: Build and publish to test pypi uses: JRubics/poetry-publish@v1.2 @@ -22,4 +27,4 @@ jobs: poetry_version: ">=0.12" pypi_token: ${{ secrets.TEST_PYPI_TOKEN }} repository_name: "testpypi" - repository_url: "https://test.pypi.org/legacy/" \ No newline at end of file + repository_url: "https://test.pypi.org/legacy/" diff --git a/Makefile b/Makefile index 9b434b94..4c9cbd20 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ -timestamp = `date +%s` - +.PHONY: test format check install sh run test: @pytest --cov=./scanapi --cov-report=xml @@ -8,7 +7,7 @@ check: @black -l 80 --check . --exclude=.venv change-version: - @poetry version 2.1.0-$(timestamp) + @poetry-dynamic-versioning format: @black -l 80 . --exclude=.venv @@ -26,4 +25,3 @@ run: bandit: @bandit -r scanapi -.PHONY: test format check install sh run diff --git a/pyproject.toml b/pyproject.toml index 22c5e2b0..15d652e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,12 @@ pre-commit = "2.6.0" isort = "^5.5.3" bandit = "^1.6.2" +[tool.poetry-dynamic-versioning] +enable = true +vcs = "git" +style = "semver" +latest-tag = true + [tool.isort] multi_line_output = 3 include_trailing_comma = true diff --git a/scanapi/__version__.py b/scanapi/__version__.py new file mode 100644 index 00000000..9aa3f903 --- /dev/null +++ b/scanapi/__version__.py @@ -0,0 +1 @@ +__version__ = "2.1.0" From d75c4a208affb8bd41589646cc923c98e181fdc2 Mon Sep 17 00:00:00 2001 From: Camila Maia Date: Fri, 16 Oct 2020 09:49:42 -0300 Subject: [PATCH 06/30] Fixing history (#315) * Fix publish test pypi (#307) * Update poetry-publish version Co-authored-by: Marcus Pereira Co-authored-by: Jelena Dokic --- .github/workflows/publish-to-pypi.yml | 2 +- .github/workflows/publish-to-test-pypi.yml | 17 ++++++----------- CHANGELOG.md | 2 ++ Makefile | 6 ++++-- pyproject.toml | 6 ------ scanapi/__version__.py | 1 - 6 files changed, 13 insertions(+), 21 deletions(-) delete mode 100644 scanapi/__version__.py diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 0c029175..8e5fca20 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@master - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.2 + uses: JRubics/poetry-publish@v1.3 with: python_version: "3.6" poetry_version: ">=0.12" diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 99349151..7b3fc559 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -8,23 +8,18 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - name: Set up Python - uses: actions/setup-python@v2 + - name: Poetry Setup + uses: dschep/install-poetry-action@v1.3 with: - python-version: "3.x" - - name: Install dependencies + version: 1.1.1 + - name: Run poetry pre-release run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Install poetry-dynamic-versioning - run: | - pip install poetry-dynamic-versioning==0.9.0 make change-version - name: Build and publish to test pypi - uses: JRubics/poetry-publish@v1.2 + uses: JRubics/poetry-publish@v1.3 with: python_version: "3.6" poetry_version: ">=0.12" pypi_token: ${{ secrets.TEST_PYPI_TOKEN }} repository_name: "testpypi" - repository_url: "https://test.pypi.org/legacy/" + repository_url: "https://test.pypi.org/legacy/" \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 438f24bd..fc054c50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Updated poetry-publish version to v1.3 [#311](https://github.com/scanapi/scanapi/pull/311) ## [2.1.0] - 2020-10-06 ### Added diff --git a/Makefile b/Makefile index 4c9cbd20..9b434b94 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -.PHONY: test format check install sh run +timestamp = `date +%s` + test: @pytest --cov=./scanapi --cov-report=xml @@ -7,7 +8,7 @@ check: @black -l 80 --check . --exclude=.venv change-version: - @poetry-dynamic-versioning + @poetry version 2.1.0-$(timestamp) format: @black -l 80 . --exclude=.venv @@ -25,3 +26,4 @@ run: bandit: @bandit -r scanapi +.PHONY: test format check install sh run diff --git a/pyproject.toml b/pyproject.toml index 15d652e9..22c5e2b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,12 +36,6 @@ pre-commit = "2.6.0" isort = "^5.5.3" bandit = "^1.6.2" -[tool.poetry-dynamic-versioning] -enable = true -vcs = "git" -style = "semver" -latest-tag = true - [tool.isort] multi_line_output = 3 include_trailing_comma = true diff --git a/scanapi/__version__.py b/scanapi/__version__.py deleted file mode 100644 index 9aa3f903..00000000 --- a/scanapi/__version__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "2.1.0" From eb18b156b9a1dfa4a29d0206b1c9998b46e95b43 Mon Sep 17 00:00:00 2001 From: Jelena Dokic Date: Mon, 19 Oct 2020 14:30:50 +0200 Subject: [PATCH 07/30] Fixed all flake8 errors (#309) Fixed all flake8 errors --- CHANGELOG.md | 3 +++ scanapi/__init__.py | 3 ++- scanapi/__main__.py | 1 - scanapi/evaluators/code_evaluator.py | 10 +++++----- scanapi/scan.py | 1 - scanapi/tree/request_node.py | 2 +- scanapi/tree/testing_node.py | 2 -- scanapi/utils.py | 2 +- tests/unit/evaluators/test_code_evaluator.py | 6 ++---- tests/unit/evaluators/test_spec_evaluator.py | 5 +---- tests/unit/test_config_loader.py | 1 - tests/unit/test_hide_utils.py | 2 +- tests/unit/test_main.py | 2 -- tests/unit/test_reporter.py | 4 ++-- tests/unit/test_scan.py | 4 ++-- tests/unit/test_settings.py | 4 +--- tests/unit/test_utils.py | 1 - tests/unit/tree/test_endpoint_node.py | 20 ++++++++++---------- tests/unit/tree/test_request_node.py | 20 +++++++++----------- tests/unit/tree/test_testing_node.py | 3 +-- 20 files changed, 41 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc054c50..1e7c71a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Updated poetry-publish version to v1.3 [#311](https://github.com/scanapi/scanapi/pull/311) +### Fixed +- Removed all flake8 errors [#309](https://github.com/scanapi/scanapi/pull/309) + ## [2.1.0] - 2020-10-06 ### Added - Add a `delay` key option to perform a delay between each request. [#266](https://github.com/scanapi/scanapi/issues/266) diff --git a/scanapi/__init__.py b/scanapi/__init__.py index c392ee11..01fa9b6c 100644 --- a/scanapi/__init__.py +++ b/scanapi/__init__.py @@ -1,4 +1,5 @@ -name = "scanapi" from scanapi.__main__ import main +name = "scanapi" + __all__ = ["main"] diff --git a/scanapi/__main__.py b/scanapi/__main__.py index f35b5225..f90e65f2 100644 --- a/scanapi/__main__.py +++ b/scanapi/__main__.py @@ -5,7 +5,6 @@ from scanapi.exit_code import ExitCode from scanapi.scan import scan -from scanapi.session import session from scanapi.settings import settings CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) diff --git a/scanapi/evaluators/code_evaluator.py b/scanapi/evaluators/code_evaluator.py index 68f39dd2..d9cde660 100644 --- a/scanapi/evaluators/code_evaluator.py +++ b/scanapi/evaluators/code_evaluator.py @@ -1,11 +1,11 @@ # Available imports to be used dinamically in the API spec -import datetime +import datetime # noqa: F401 import logging -import math -import random +import math # noqa: F401 +import random # noqa: F401 import re -import time -import uuid +import time # noqa: F401 +import uuid # noqa: F401 from scanapi.errors import InvalidPythonCodeError diff --git a/scanapi/scan.py b/scanapi/scan.py index ec7a7c7f..c3ce1159 100644 --- a/scanapi/scan.py +++ b/scanapi/scan.py @@ -14,7 +14,6 @@ from scanapi.session import session from scanapi.settings import settings from scanapi.tree import EndpointNode -from scanapi.tree.tree_keys import ROOT_SCOPE logger = logging.getLogger(__name__) diff --git a/scanapi/tree/request_node.py b/scanapi/tree/request_node.py index 106514e1..ae1861db 100644 --- a/scanapi/tree/request_node.py +++ b/scanapi/tree/request_node.py @@ -4,7 +4,7 @@ import requests from scanapi.errors import HTTPMethodNotAllowedError -from scanapi.evaluators.spec_evaluator import SpecEvaluator +from scanapi.evaluators.spec_evaluator import SpecEvaluator # noqa: F401 from scanapi.hide_utils import hide_sensitive_info from scanapi.test_status import TestStatus from scanapi.tree.testing_node import TestingNode diff --git a/scanapi/tree/testing_node.py b/scanapi/tree/testing_node.py index 1dfcda30..38fe85e8 100644 --- a/scanapi/tree/testing_node.py +++ b/scanapi/tree/testing_node.py @@ -1,7 +1,5 @@ import logging -import requests - from scanapi.session import session from scanapi.test_status import TestStatus from scanapi.tree.tree_keys import ASSERT_KEY, NAME_KEY diff --git a/scanapi/utils.py b/scanapi/utils.py index 17c418d1..f2bceee3 100644 --- a/scanapi/utils.py +++ b/scanapi/utils.py @@ -26,7 +26,7 @@ def validate_keys(keys, available_keys, required_keys, scope): def _validate_allowed_keys(keys, available_keys, scope): """ Private function that checks validation of allowed keys. """ for key in keys: - if not key in available_keys: + if key not in available_keys: raise InvalidKeyError(key, scope, available_keys) diff --git a/tests/unit/evaluators/test_code_evaluator.py b/tests/unit/evaluators/test_code_evaluator.py index 7f127cad..b49b74ed 100644 --- a/tests/unit/evaluators/test_code_evaluator.py +++ b/tests/unit/evaluators/test_code_evaluator.py @@ -1,10 +1,8 @@ -import os - import pytest import requests -from scanapi.errors import BadConfigurationError, InvalidPythonCodeError -from scanapi.evaluators import CodeEvaluator, SpecEvaluator, StringEvaluator +from scanapi.errors import InvalidPythonCodeError +from scanapi.evaluators import CodeEvaluator class TestCodeEvaluator: diff --git a/tests/unit/evaluators/test_spec_evaluator.py b/tests/unit/evaluators/test_spec_evaluator.py index 5acf39e1..2f6740a5 100644 --- a/tests/unit/evaluators/test_spec_evaluator.py +++ b/tests/unit/evaluators/test_spec_evaluator.py @@ -1,8 +1,5 @@ -import os - import pytest -from scanapi.errors import BadConfigurationError, InvalidPythonCodeError from scanapi.evaluators.spec_evaluator import SpecEvaluator from scanapi.tree import EndpointNode @@ -83,7 +80,7 @@ class TestSpecEvaluatorGetKey: def test_should_return_none(self, spec_evaluator): key = "some_key" value = spec_evaluator.get(key) - assert value == None + assert value is None def test_should_return_foo(self, spec_evaluator): key = "name" diff --git a/tests/unit/test_config_loader.py b/tests/unit/test_config_loader.py index 7eb4b2da..ed8583f1 100644 --- a/tests/unit/test_config_loader.py +++ b/tests/unit/test_config_loader.py @@ -1,5 +1,4 @@ import pytest -import yaml from scanapi.config_loader import load_config_file from scanapi.errors import EmptyConfigFileError diff --git a/tests/unit/test_hide_utils.py b/tests/unit/test_hide_utils.py index 8efc9791..e2a81a68 100644 --- a/tests/unit/test_hide_utils.py +++ b/tests/unit/test_hide_utils.py @@ -74,7 +74,7 @@ class TestOverrideInfo: def test_overrides_url(self, response): secret_key = "129e8cb2-d19c-51ad-9921-cea329bed7fa" response.url = ( - f"http://test.com/users/129e8cb2-d19c-51ad-9921-cea329bed7fa/details" + "http://test.com/users/129e8cb2-d19c-51ad-9921-cea329bed7fa/details" ) http_attr = "url" secret_field = secret_key diff --git a/tests/unit/test_main.py b/tests/unit/test_main.py index 2c11d0da..9dbcaaba 100644 --- a/tests/unit/test_main.py +++ b/tests/unit/test_main.py @@ -1,7 +1,5 @@ import logging -import os -import pytest import yaml from click.testing import CliRunner diff --git a/tests/unit/test_reporter.py b/tests/unit/test_reporter.py index b81db504..fd3940bb 100644 --- a/tests/unit/test_reporter.py +++ b/tests/unit/test_reporter.py @@ -4,8 +4,8 @@ from scanapi.reporter import Reporter fake_results = [ - {"response": "foo", "tests_results": [], "no_failure": True,}, - {"response": "bar", "tests_results": [], "no_failure": False,}, + {"response": "foo", "tests_results": [], "no_failure": True}, + {"response": "bar", "tests_results": [], "no_failure": False}, ] diff --git a/tests/unit/test_scan.py b/tests/unit/test_scan.py index 8495575e..0a7b59c3 100644 --- a/tests/unit/test_scan.py +++ b/tests/unit/test_scan.py @@ -39,7 +39,7 @@ def response(requests_mock): class TestScan: class TestWhenCouldNotFindAPISpecFile: def test_should_log_error(self, mocker, caplog): - mock_settings = mocker.patch( + mocker.patch( "scanapi.scan.settings", {"spec_path": "invalid_path/scanapi.yaml"} ) mocker.patch("scanapi.scan.load_config_file", side_effect=file_not_found) @@ -126,7 +126,7 @@ def test_should_call_wr(self, mocker, response): mock_write = mocker.patch("scanapi.scan.Reporter.write") mock_reporter_init = mocker.patch("scanapi.scan.Reporter.__init__") mock_reporter_init.return_value = None - mock_settings = mocker.patch( + mocker.patch( "scanapi.scan.settings", { "output_path": "out/my-report.md", diff --git a/tests/unit/test_settings.py b/tests/unit/test_settings.py index 68432734..d2c14c56 100644 --- a/tests/unit/test_settings.py +++ b/tests/unit/test_settings.py @@ -1,8 +1,6 @@ -import os - import pytest -from scanapi.settings import LOCAL_CONFIG_PATH, settings +from scanapi.settings import settings @pytest.fixture diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 6f853154..fb5bc1b3 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -2,7 +2,6 @@ import requests from scanapi.errors import InvalidKeyError, MissingMandatoryKeyError -from scanapi.hide_utils import _hide, _override_info, hide_sensitive_info from scanapi.utils import join_urls, validate_keys diff --git a/tests/unit/tree/test_endpoint_node.py b/tests/unit/tree/test_endpoint_node.py index 52bce30b..6f6b890b 100644 --- a/tests/unit/tree/test_endpoint_node.py +++ b/tests/unit/tree/test_endpoint_node.py @@ -62,11 +62,11 @@ def test_when_parent_has_url(self): node = EndpointNode( {"path": "/foo", "name": "node", "requests": []}, parent=parent ) - assert node.path == f"http://foo.com/api/foo" + assert node.path == "http://foo.com/api/foo" def test_with_trailing_slashes(self): parent = EndpointNode( - {"path": "http://foo.com/", "name": "parent-node", "requests": [],} + {"path": "http://foo.com/", "name": "parent-node", "requests": []} ) node = EndpointNode( {"path": "/foo/", "name": "node", "requests": []}, parent=parent @@ -75,7 +75,7 @@ def test_with_trailing_slashes(self): def test_with_path_not_string(self): parent = EndpointNode( - {"path": "http://foo.com/", "name": "parent-node", "requests": [],} + {"path": "http://foo.com/", "name": "parent-node", "requests": []} ) node = EndpointNode( {"path": 2, "name": "node", "requests": []}, parent=parent @@ -84,7 +84,7 @@ def test_with_path_not_string(self): def test_calls_evaluate(self, mocker, mock_evaluate): parent = EndpointNode( - {"path": "http://foo.com/", "name": "parent-node", "requests": [],} + {"path": "http://foo.com/", "name": "parent-node", "requests": []} ) node = EndpointNode( {"path": "/foo/", "name": "node", "requests": []}, parent=parent @@ -109,7 +109,7 @@ def test_when_parent_has_headers(self): node = EndpointNode( {"headers": headers, "name": "node", "requests": []}, parent=EndpointNode( - {"headers": parent_headers, "name": "parent-node", "requests": [],} + {"headers": parent_headers, "name": "parent-node", "requests": []} ), ) assert node.headers == {"abc": "def", "xxx": "www"} @@ -120,7 +120,7 @@ def test_when_parent_has_repeated_keys(self): node = EndpointNode( {"headers": headers, "name": "node", "requests": []}, parent=EndpointNode( - {"headers": parent_headers, "name": "parent-node", "requests": [],} + {"headers": parent_headers, "name": "parent-node", "requests": []} ), ) assert node.headers == {"abc": "def", "xxx": "www"} @@ -140,7 +140,7 @@ def test_when_parent_has_params(self): node = EndpointNode( {"params": params, "name": "node", "requests": []}, parent=EndpointNode( - {"params": parent_params, "name": "parent-node", "requests": [],} + {"params": parent_params, "name": "parent-node", "requests": []} ), ) assert node.params == {"abc": "def", "xxx": "www"} @@ -151,7 +151,7 @@ def test_when_parent_has_repeated_keys(self): node = EndpointNode( {"params": params, "name": "node", "requests": []}, parent=EndpointNode( - {"params": parent_params, "name": "parent-node", "requests": [],} + {"params": parent_params, "name": "parent-node", "requests": []} ), ) assert node.params == {"abc": "def", "xxx": "www"} @@ -219,8 +219,8 @@ def test_when_node_has_children(self): { "name": "foo", "requests": [ - {"name": "First", "path": "http://foo.com/first",}, - {"name": "Second", "path": "http://foo.com/second",}, + {"name": "First", "path": "http://foo.com/first"}, + {"name": "Second", "path": "http://foo.com/second"}, ], } ], diff --git a/tests/unit/tree/test_request_node.py b/tests/unit/tree/test_request_node.py index 73d3f95c..010a76b3 100644 --- a/tests/unit/tree/test_request_node.py +++ b/tests/unit/tree/test_request_node.py @@ -22,7 +22,7 @@ def test_init_spec_and_endpoint(self): def test_missing_required_keys(self): with pytest.raises(MissingMandatoryKeyError) as excinfo: - request = RequestNode( + RequestNode( spec={}, endpoint=EndpointNode({"name": "foo", "requests": [{}]}), ) @@ -67,9 +67,7 @@ def test_when_request_has_name(self): @pytest.mark.skip("it should validate mandatory `name` key before") def test_when_request_has_no_name(self): with pytest.raises(MissingMandatoryKeyError) as excinfo: - request = RequestNode( - {}, endpoint=EndpointNode({"name": "foo", "requests": []}) - ) + RequestNode({}, endpoint=EndpointNode({"name": "foo", "requests": []})) assert str(excinfo.value) == "Missing name, path at 'request'" @@ -88,7 +86,7 @@ def test_when_endpoint_has_url(self): {"name": "foo", "requests": [{}], "path": endpoint_path} ) request = RequestNode({"path": "/foo", "name": "foo"}, endpoint=endpoint) - assert request.full_url_path == f"http://foo.com/api/foo" + assert request.full_url_path == "http://foo.com/api/foo" def test_with_trailing_slashes(self): endpoint = EndpointNode( @@ -129,7 +127,7 @@ def test_when_endpoint_has_headers(self): request = RequestNode( {"headers": headers, "path": "http://foo.com", "name": "foo"}, endpoint=EndpointNode( - {"headers": endpoint_headers, "name": "foo", "requests": [{}],} + {"headers": endpoint_headers, "name": "foo", "requests": [{}]} ), ) assert request.headers == {"abc": "def", "xxx": "www"} @@ -140,7 +138,7 @@ def test_with_repeated_keys(self): request = RequestNode( {"headers": headers, "path": "http://foo.com", "name": "foo"}, endpoint=EndpointNode( - {"headers": endpoint_headers, "name": "foo", "requests": [{}],} + {"headers": endpoint_headers, "name": "foo", "requests": [{}]} ), ) assert request.headers == {"abc": "def", "xxx": "www"} @@ -151,7 +149,7 @@ def test_calls_evaluate(self, mocker, mock_evaluate): ) request = RequestNode( - {"headers": {"ghi": "jkl"}, "path": "http://foo.com", "name": "foo",}, + {"headers": {"ghi": "jkl"}, "path": "http://foo.com", "name": "foo"}, endpoint=endpoint, ) request.headers @@ -196,7 +194,7 @@ def test_calls_evaluate(self, mocker, mock_evaluate): ) request = RequestNode( - {"params": {"ghi": "jkl"}, "path": "http://foo.com", "name": "foo",}, + {"params": {"ghi": "jkl"}, "path": "http://foo.com", "name": "foo"}, endpoint=endpoint, ) request.params @@ -240,14 +238,14 @@ def test_when_request_has_no_body(self): def test_when_request_has_body(self): request = RequestNode( - {"body": {"abc": "def"}, "path": "http://foo.com", "name": "foo",}, + {"body": {"abc": "def"}, "path": "http://foo.com", "name": "foo"}, endpoint=EndpointNode({"name": "foo", "requests": [{}]}), ) assert request.body == {"abc": "def"} def test_calls_evaluate(self, mocker, mock_evaluate): request = RequestNode( - {"body": {"ghi": "jkl"}, "path": "http://foo.com", "name": "foo",}, + {"body": {"ghi": "jkl"}, "path": "http://foo.com", "name": "foo"}, endpoint=EndpointNode({"name": "foo", "requests": [{}]}), ) request.body diff --git a/tests/unit/tree/test_testing_node.py b/tests/unit/tree/test_testing_node.py index 10ecf906..bb2ecb36 100644 --- a/tests/unit/tree/test_testing_node.py +++ b/tests/unit/tree/test_testing_node.py @@ -16,7 +16,7 @@ def test_missing_required_keys(self): spec={"name": "foo", "path": "bar"}, endpoint=EndpointNode({"name": "foo", "requests": [{}]}), ) - test_node = TestingNode(spec={}, request=request_node) + TestingNode(spec={}, request=request_node) assert ( str(excinfo.value) == "Missing 'assert', 'name' key(s) at 'test' scope" @@ -35,7 +35,6 @@ def test_full_name(self): class TestRun: @pytest.fixture def testing_node(self): - __test__ = False endpoint_node = EndpointNode(spec={"name": "foo"}) request_node = RequestNode(spec={"name": "bar"}, endpoint=endpoint_node) spec = { From 94332c4b55760424d845b4e6e7f9bbc85203e4eb Mon Sep 17 00:00:00 2001 From: Jelena Dokic Date: Fri, 23 Oct 2020 20:11:55 +0200 Subject: [PATCH 08/30] Add flake8 check (#321) * Add flake8 check --- .github/workflows/lint.yml | 11 ++++++++++- CHANGELOG.md | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6ae67300..84012b2a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,7 +2,7 @@ on: pull_request name: Lint check jobs: black: - name: Lint check + name: black check runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -10,3 +10,12 @@ jobs: uses: "./.github/actions/black" with: args: ". --check" + flake8: + name: flake8 check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: "Flake8 check" + uses: TrueBrain/actions-flake8@master + with: + ignore: E501,W # ignore line length check and warnings \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e7c71a5..79be251d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Added flake8 check workflow on pull_request event [#321](https://github.com/scanapi/scanapi/pull/321) + ### Changed - Updated poetry-publish version to v1.3 [#311](https://github.com/scanapi/scanapi/pull/311) From 063b490a6cd327d07e199b48800e249d9383af58 Mon Sep 17 00:00:00 2001 From: Camila Maia Date: Mon, 26 Oct 2020 19:59:20 -0300 Subject: [PATCH 09/30] Remove `scanapi-report.html' and 'scanapi.yaml' from gitignore (#327) --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 73f397e5..1109a81a 100644 --- a/.gitignore +++ b/.gitignore @@ -629,6 +629,3 @@ MigrationBackup/ .vscode/ # End of https://www.gitignore.io/api/macos,python,visualstudio,visualstudiocode - -scanapi-report.html -scanapi.yaml \ No newline at end of file From f6a334bc1bc98e07c2792d714ef28191c59341ec Mon Sep 17 00:00:00 2001 From: Pedro Lages <55694628+pxd3v@users.noreply.github.com> Date: Sat, 31 Oct 2020 13:20:48 -0300 Subject: [PATCH 10/30] Add anchor link for each request in the report to make it easily shareable (#317) Add anchor to each endpoint on Report --- CHANGELOG.md | 4 +++- scanapi/templates/report.html | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79be251d..2b6e8684 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -### Added + +### Added - Added flake8 check workflow on pull_request event [#321](https://github.com/scanapi/scanapi/pull/321) +- Add anchor link for each request in the report to make it easily shareable. [#317](https://github.com/scanapi/scanapi/pull/317) ### Changed - Updated poetry-publish version to v1.3 [#311](https://github.com/scanapi/scanapi/pull/311) diff --git a/scanapi/templates/report.html b/scanapi/templates/report.html index 09b04039..39763120 100644 --- a/scanapi/templates/report.html +++ b/scanapi/templates/report.html @@ -401,7 +401,7 @@

Report generated for your API

{% set endpoint_status_label = "P" if result["no_failure"] else "F" %} {% set request = response.request %} -
+