Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start testing with CPython 3.13 #862

Merged
merged 5 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "pypy-3.8"
- "pypy-3.9"
- "pypy-3.10"
Expand Down Expand Up @@ -48,6 +49,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: pip
allow-prereleases: true

- name: Install project dependencies
run: |
Expand Down
16 changes: 0 additions & 16 deletions tests/integration/conftest.py

This file was deleted.

22 changes: 13 additions & 9 deletions tests/integration/test_aiohttp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import logging
import ssl
import urllib.parse

import pytest
import pytest_httpbin.certs

import vcr

Expand All @@ -11,6 +13,8 @@

from .aiohttp_utils import aiohttp_app, aiohttp_request # noqa: E402

HTTPBIN_SSL_CONTEXT = ssl.create_default_context(cafile=pytest_httpbin.certs.where())


def run_in_loop(fn):
async def wrapper():
Expand Down Expand Up @@ -338,7 +342,7 @@ def test_double_requests(tmpdir, httpbin):
assert cassette.play_count == 2


def test_cookies(httpbin_both, httpbin_ssl_context, tmpdir):
def test_cookies(httpbin_both, tmpdir):
async def run(loop):
cookies_url = httpbin_both.url + (
"/response-headers?"
Expand All @@ -353,25 +357,25 @@ async def run(loop):
# ------------------------- Record -------------------------- #
with vcr.use_cassette(tmp) as cassette:
async with aiohttp.ClientSession(loop=loop, cookie_jar=aiohttp.CookieJar(unsafe=True)) as session:
cookies_resp = await session.get(cookies_url, ssl=httpbin_ssl_context)
cookies_resp = await session.get(cookies_url, ssl=HTTPBIN_SSL_CONTEXT)
home_resp = await session.get(
home_url,
cookies=req_cookies,
headers=req_headers,
ssl=httpbin_ssl_context,
ssl=HTTPBIN_SSL_CONTEXT,
)
assert cassette.play_count == 0
assert_responses(cookies_resp, home_resp)

# -------------------------- Play --------------------------- #
with vcr.use_cassette(tmp, record_mode=vcr.mode.NONE) as cassette:
async with aiohttp.ClientSession(loop=loop, cookie_jar=aiohttp.CookieJar(unsafe=True)) as session:
cookies_resp = await session.get(cookies_url, ssl=httpbin_ssl_context)
cookies_resp = await session.get(cookies_url, ssl=HTTPBIN_SSL_CONTEXT)
home_resp = await session.get(
home_url,
cookies=req_cookies,
headers=req_headers,
ssl=httpbin_ssl_context,
ssl=HTTPBIN_SSL_CONTEXT,
)
assert cassette.play_count == 2
assert_responses(cookies_resp, home_resp)
Expand All @@ -388,7 +392,7 @@ def assert_responses(cookies_resp, home_resp):
run_in_loop(run)


def test_cookies_redirect(httpbin_both, httpbin_ssl_context, tmpdir):
def test_cookies_redirect(httpbin_both, tmpdir):
async def run(loop):
# Sets cookie as provided by the query string and redirects
cookies_url = httpbin_both.url + "/cookies/set?Cookie_1=Val_1"
Expand All @@ -397,7 +401,7 @@ async def run(loop):
# ------------------------- Record -------------------------- #
with vcr.use_cassette(tmp) as cassette:
async with aiohttp.ClientSession(loop=loop, cookie_jar=aiohttp.CookieJar(unsafe=True)) as session:
cookies_resp = await session.get(cookies_url, ssl=httpbin_ssl_context)
cookies_resp = await session.get(cookies_url, ssl=HTTPBIN_SSL_CONTEXT)
assert not cookies_resp.cookies
cookies = session.cookie_jar.filter_cookies(cookies_url)
assert cookies["Cookie_1"].value == "Val_1"
Expand All @@ -408,7 +412,7 @@ async def run(loop):
# -------------------------- Play --------------------------- #
with vcr.use_cassette(tmp, record_mode=vcr.mode.NONE) as cassette:
async with aiohttp.ClientSession(loop=loop, cookie_jar=aiohttp.CookieJar(unsafe=True)) as session:
cookies_resp = await session.get(cookies_url, ssl=httpbin_ssl_context)
cookies_resp = await session.get(cookies_url, ssl=HTTPBIN_SSL_CONTEXT)
assert not cookies_resp.cookies
cookies = session.cookie_jar.filter_cookies(cookies_url)
assert cookies["Cookie_1"].value == "Val_1"
Expand All @@ -422,7 +426,7 @@ async def run(loop):
"Cookie_1=Val_1; Expires=Wed, 21 Oct 2015 07:28:00 GMT",
]
async with aiohttp.ClientSession(loop=loop, cookie_jar=aiohttp.CookieJar(unsafe=True)) as session:
cookies_resp = await session.get(cookies_url, ssl=httpbin_ssl_context)
cookies_resp = await session.get(cookies_url, ssl=HTTPBIN_SSL_CONTEXT)
assert not cookies_resp.cookies
cookies = session.cookie_jar.filter_cookies(cookies_url)
assert cookies["Cookie_1"].value == "Val_1"
Expand Down