From 23c57127fc7248d0752f0606632cc4b200262eb0 Mon Sep 17 00:00:00 2001 From: Frode Aannevik Date: Sun, 20 Nov 2022 13:41:12 +0100 Subject: [PATCH] Bump python from 3.8 to 3.10 (#4) Bump pytest and pytes-bdd to get support for python3.10 - pytest from 5.3.4 to 7.2.0 - pytest-bdd from 3.2.1 to 4.1.0 (5 and 6 have to many breaking changes) See: https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst Bump other dependencies - boto3 - bravado-core - cryptography - pycodestyle - PyJWT - pytest-parallel - requests The `requirements.txt` was updated wit the output from `pip freeze` after new version of the dependencies was installed Rel: https://github.com/pytest-dev/pytest/pull/8540 --- Dockerfile | 5 +-- Makefile | 1 + README.md | 6 +++ example/test_feature.py | 11 +++-- requirements.txt | 99 ++++++++++++++++++++--------------------- 5 files changed, 66 insertions(+), 56 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2f53d06..79da1e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ -FROM python:3.8.1-alpine3.11 +FROM python:3.10.8-alpine3.16 +RUN apk --no-cache --update add openssl libffi patch COPY requirements.txt . - -RUN apk --no-cache --update add openssl libffi RUN apk --no-cache --update add --virtual build-dependencies build-base libffi-dev openssl-dev \ && pty=False python3 -m pip install --disable-pip-version-check -r requirements.txt \ && apk del build-dependencies diff --git a/Makefile b/Makefile index 3a47b91..137bb1f 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ build: test: @docker run \ + --rm \ -e PYTEST_ADDOPTS="$(PYTEST_ADDOPTS)" \ -v $(CURDIR)/example:/example \ -w /example $(TAG) \ diff --git a/README.md b/README.md index e87fa6e..72ba0de 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,14 @@ run with volume mount The docker image installs many useful libraries for testing REST APIs with pytest-bdd. + - boto3 - [bravado_core]: support for the OpenAPI Specification v2.0. (Swagger 2) + - cryptography + - pytcodestyle - [PyJWT]: JSON Web Token implementation in Python + - pytest-bdd + - pytest-parallel + - pytest - [Requests]: HTTP for Humans See the [requirements.txt] for complete list of libraries installed by the [Dockerfile]. diff --git a/example/test_feature.py b/example/test_feature.py index e0634b8..914ff62 100644 --- a/example/test_feature.py +++ b/example/test_feature.py @@ -1,13 +1,18 @@ import requests - +from pytest import fixture from pytest_bdd import ( scenarios, given, when, then, parsers ) +@fixture +def request_ctx(): + return dict() + + @given('a ') -def request_ctx(url): - return dict(url=url) +def given_url(request_ctx, url): + request_ctx['url'] = url @when(parsers.parse("I request {method}")) diff --git a/requirements.txt b/requirements.txt index 494fdc7..ac432f1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,52 +1,51 @@ -asn1crypto==1.3.0 -atomicwrites==1.3.0 -attrs==19.3.0 -awscli==1.20.63 -boto3==1.18.63 -botocore==1.21.63 -bravado-core==5.16.0 -certifi==2019.11.28 -cffi==1.13.2 -chardet==3.0.4 -colorama==0.4.1 -cryptography==3.3.2 -docutils==0.15.2 +arrow==1.2.3 +attrs==22.1.0 +boto3==1.26.13 +botocore==1.29.13 +bravado-core==5.17.1 +certifi==2022.9.24 +cffi==1.15.1 +charset-normalizer==2.1.1 +cryptography==38.0.3 +exceptiongroup==1.0.4 +fqdn==1.5.1 glob2==0.7 -idna==2.8 -importlib-metadata==1.4.0 -jmespath==0.9.4 -jsonref==0.2 -jsonschema==3.2.0 -Mako==1.2.2 -MarkupSafe==1.1.1 -more-itertools==8.1.0 -msgpack-python==0.5.6 -packaging==20.1 -parse==1.14.0 -parse-type==0.5.2 -pluggy==0.13.1 -py==1.10.0 -pyasn1==0.4.8 -pycodestyle==2.5.0 -pycparser==2.19 -PyJWT==2.4.0 -pyparsing==2.4.6 -pyrsistent==0.15.7 -pytest==5.3.4 -pytest-bdd==3.2.1 -pytest-parallel==0.1.0 -python-dateutil==2.8.1 -pytz==2019.3 -PyYAML==5.4 -requests==2.26.0 +idna==3.4 +iniconfig==1.1.1 +isoduration==20.11.0 +jmespath==1.0.1 +jsonpointer==2.3 +jsonref==1.0.1 +jsonschema==4.17.0 +Mako==1.2.4 +MarkupSafe==2.1.1 +msgpack==1.0.4 +packaging==21.3 +parse==1.19.0 +parse-type==0.6.0 +pluggy==1.0.0 +py==1.11.0 +pycodestyle==2.9.1 +pycparser==2.21 +PyJWT==2.6.0 +pyparsing==3.0.9 +pyrsistent==0.19.2 +pytest==7.2.0 +pytest-bdd==4.1.0 +pytest-parallel==0.1.1 +python-dateutil==2.8.2 +pytz==2022.6 +PyYAML==6.0 +requests==2.28.1 +rfc3339-validator==0.1.4 rfc3987==1.3.8 -rsa==4.7 -s3transfer==0.5.0 -simplejson==3.17.0 -six==1.14.0 -strict-rfc3339==0.7 -swagger-spec-validator==2.4.3 -urllib3==1.26.5 -wcwidth==0.1.8 -webcolors==1.10 -zipp==2.0.1 +s3transfer==0.6.0 +simplejson==3.18.0 +six==1.16.0 +swagger-spec-validator==3.0.3 +tblib==1.7.0 +tomli==2.0.1 +typing_extensions==4.4.0 +uri-template==1.2.0 +urllib3==1.26.12 +webcolors==1.12