Skip to content

Commit

Permalink
Merge pull request #76 from graingert/3-12
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert authored May 8, 2023
2 parents 7b0f902 + b6ce78c commit 5044f5f
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, 3.12-dev]
os: [macOS-latest, ubuntu-latest, windows-latest]

steps:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Download dists for PyPI
uses: actions/download-artifact@v2
with:
name: ubuntu-latest_3.10_dist
name: ubuntu-latest_3.11_dist
path: dist

- name: Display structure of donwloaded files
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
rev: v3.4.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/psf/black
rev: 22.1.0
rev: 23.3.0
hooks:
- id: black
args: ["--target-version", "py37"]

- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: mixed-line-ending

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
rev: v3.0.0-alpha.9-for-vscode
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]

- repo: https://github.com/myint/autoflake
rev: v1.4
rev: v2.1.1
hooks:
- id: autoflake
args:
Expand All @@ -46,8 +46,8 @@ repos:
- --remove-duplicate-keys
- --remove-unused-variables

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-2020]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ tox
```

## Changelog

- 2.0.0rc2 (unreleased)
- Add support for Python 3.11 and 3.12, drop dependency on six (#76)
- 2.0.0rc1
- Drop support for Python 2.6, 2.7, 3.4, 3.5 and 3.6 (#68)
- Add support for Python 3.7, 3.8, 3.9 and 3.10 (#68)
Expand Down
Empty file added pyproject.toml
Empty file.
4 changes: 1 addition & 3 deletions pytest_httpbin/serve.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import os
import ssl
import threading
from urllib.parse import urljoin
from wsgiref.handlers import SimpleHandler
from wsgiref.simple_server import WSGIRequestHandler, WSGIServer, make_server

from six.moves.urllib.parse import urljoin

CERT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "certs")


class ServerHandler(SimpleHandler):

server_software = "Pytest-HTTPBIN/0.1.0"
http_version = "1.1"

Expand Down
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ universal=1
disable-noqa = True
max-line-length = 88
extend-ignore =
E203, # whitespace before : is not PEP8 compliant (& conflicts with black)
# whitespace before : is not PEP8 compliant (& conflicts with black)
E203


[tool:pytest]
addopts = --strict-config --strict-markers
filterwarnings = error
filterwarnings =
error
ignore:ast\.(Str|NameConstant) is deprecated:DeprecationWarning:_pytest
xfail_strict = true
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
# What does your project relate to?
keywords="pytest-httpbin testing pytest httpbin",
packages=find_packages(exclude=["contrib", "docs", "tests*"]),
include_package_data=True, # include files listed in MANIFEST.in
install_requires=["httpbin", "six"],
extras_require={"test": ["requests", "pytest"]},
install_requires=["httpbin"],
extras_require={"test": ["requests", "pytest", "werkzeug<2.1.0"]},
python_requires=">=3.7",
# the following makes a plugin available to pytest
entry_points={
Expand Down
18 changes: 15 additions & 3 deletions tests/test_httpbin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import ssl
import sys
import unittest

import requests
import pytest
import requests.exceptions

import pytest_httpbin

Expand Down Expand Up @@ -43,8 +46,17 @@ def test_httpbin_str(httpbin):
assert httpbin + "/foo" == httpbin.url + "/foo"


def test_chunked_encoding(httpbin_both):
assert requests.get(httpbin_both.url + "/stream/20").status_code == 200
def test_chunked_encoding(httpbin):
assert requests.get(httpbin.url + "/stream/20").status_code == 200


@pytest.mark.xfail(
condition=sys.version_info < (3, 8) and ssl.OPENSSL_VERSION_INFO >= (3, 0, 0),
reason="fails on python3.7 openssl 3+",
raises=requests.exceptions.SSLError,
)
def test_chunked_encoding_secure(httpbin_secure):
assert requests.get(httpbin_secure.url + "/stream/20").status_code == 200


@pytest_httpbin.use_class_based_httpbin
Expand Down
2 changes: 1 addition & 1 deletion tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ def test_redirect_location_is_https_for_secure_server(httpbin_secure):
)
assert response.status_code == 302
assert response.headers.get("Location")
assert response.headers["Location"].startswith("https://")
assert response.headers["Location"] == "/html"
1 change: 0 additions & 1 deletion tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


def get_raw_http_response(host, port, path):

CRLF = b"\r\n"

request = [
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# content of: tox.ini , put in same dir as setup.py

[tox]
minversion=3.24.5
minversion=3.28.0
requires=
virtualenv>=20.13.2
tox-wheel>=0.7.0
tox-gh-actions>=2.9.1
tox<4
envlist = py37, py38, py39, py310, pypy3

[testenv]
wheel = True
wheel_build_env = build
wheel_pep517 = build
extras = test
commands = pytest -v -s {posargs}

Expand Down

0 comments on commit 5044f5f

Please sign in to comment.