Skip to content

Commit

Permalink
Run test_requesting_large_resources_via_ssl separately
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin committed Nov 5, 2023
1 parent 6fc4260 commit b8177d9
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
- ubuntu-22.04 # OpenSSL 3.0
nox-session: ['']
include:
- experimental: false
- python-version: "3.12"
os: ubuntu-latest
experimental: false
nox-session: test_integration
- python-version: "pypy-3.8"
os: ubuntu-latest
experimental: false
Expand Down
10 changes: 9 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def tests_impl(
session: nox.Session,
extras: str = "socks,brotli,zstd",
byte_string_comparisons: bool = True,
integration: bool = False,
) -> None:
# Install deps and the package itself.
session.install("-r", "dev-requirements.txt")
Expand Down Expand Up @@ -44,6 +45,7 @@ def tests_impl(
*("--memray", "--hide-memray-summary") if memray_supported else (),
"-v",
"-ra",
*(("--integration",) if integration else ()),
f"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}",
"--tb=native",
"--durations=10",
Expand All @@ -59,7 +61,13 @@ def test(session: nox.Session) -> None:
tests_impl(session)


@nox.session(python=["3"])
@nox.session(python="3")
def test_integration(session: nox.Session) -> None:
"""Run integration tests"""
tests_impl(session, integration=True)


@nox.session(python="3")
def test_brotlipy(session: nox.Session) -> None:
"""Check that if 'brotlipy' is installed instead of 'brotli' or
'brotlicffi' that we still don't blow up.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ python_classes = ["Test", "*TestCase"]
markers = [
"limit_memory: Limit memory with memray",
"requires_network: This test needs access to the Internet",
"integration: Slow integrations tests not run by default",
]
log_level = "DEBUG"
filterwarnings = [
Expand Down
24 changes: 24 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@
from .tz_stub import stub_timezone_ctx


def pytest_addoption(parser):
parser.addoption(
"--integration",
action="store_true",
default=False,
help="run integration tests only",
)


def pytest_collection_modifyitems(config, items):
integration_mode = bool(config.getoption("--integration"))
skip_integration = pytest.mark.skip(
reason="skipping, need --integration option to run"
)
skip_normal = pytest.mark.skip(
reason="skipping non integration tests in --integration mode"
)
for item in items:
if "integration" in item.keywords and not integration_mode:
item.add_marker(skip_integration)
elif integration_mode and "integration" not in item.keywords:
item.add_marker(skip_normal)


class ServerConfig(typing.NamedTuple):
scheme: str
host: str
Expand Down
6 changes: 1 addition & 5 deletions test/with_dummyserver/test_socketlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import shutil
import socket
import ssl
import sys
import tempfile
import time
import typing
Expand Down Expand Up @@ -1584,10 +1583,7 @@ def socket_handler(listener: socket.socket) -> None:
pool.request("GET", "/", retries=False, timeout=LONG_TIMEOUT)
assert server_closed.wait(LONG_TIMEOUT), "The socket was not terminated"

@pytest.mark.skipif(
os.environ.get("CI") == "true" and sys.implementation.name == "pypy",
reason="too slow to run in CI",
)
@pytest.mark.integration
@pytest.mark.parametrize(
"preload_content,read_amt", [(True, None), (False, None), (False, 2**31)]
)
Expand Down

0 comments on commit b8177d9

Please sign in to comment.