MCPcopy
hub / github.com/urllib3/urllib3 / tests_impl

Function tests_impl

noxfile.py:15–104  ·  view source on GitHub ↗
(
    session: nox.Session,
    extras: str | None = None,
    extra_dependencies: list[str] | None = None,
    # hypercorn dependency h2 compares bytes and strings
    # https://github.com/python-hyper/h2/issues/1236
    byte_string_comparisons: bool = False,
    integration: bool = False,
    pytest_extra_args: list[str] = [],
    dependency_group: str = "dev",
    no_default_groups: bool = False,
)

Source from the content-addressed store, hash-verified

13
14
15def tests_impl(
16 session: nox.Session,
17 extras: str | None = None,
18 extra_dependencies: list[str] | None = None,
19 # hypercorn dependency h2 compares bytes and strings
20 # https://github.com/python-hyper/h2/issues/1236
21 byte_string_comparisons: bool = False,
22 integration: bool = False,
23 pytest_extra_args: list[str] = [],
24 dependency_group: str = "dev",
25 no_default_groups: bool = False,
26) -> None:
27 # Retrieve sys info from the Python implementation under test
28 # to avoid enabling memray when nox runs under CPython but tests PyPy
29 session_python_info = session.run(
30 "python",
31 "-c",
32 "import sys; print(sys.implementation.name, sys.version_info.releaselevel, getattr(sys, '_is_gil_enabled', lambda: True)())",
33 silent=True,
34 ).strip() # type: ignore[union-attr] # mypy doesn't know that silent=True will return a string
35 implementation_name, release_level, _is_gil_enabled = session_python_info.split(" ")
36 free_threading = _is_gil_enabled == "False"
37
38 if extras is None:
39 # brotlicffi does not support free-threading
40 extras = "socks,zstd,h2" if free_threading else "socks,brotli,zstd,h2"
41
42 # Install deps and the package itself.
43 session.run_install(
44 "uv",
45 "sync",
46 "--frozen",
47 *("--no-default-groups",) if no_default_groups else (),
48 "--group",
49 dependency_group,
50 *(f"--extra={extra}" for extra in (extras.split(",") if extras else ())),
51 )
52 if extra_dependencies:
53 session.install(*extra_dependencies)
54 # Show the uv version.
55 session.run("uv", "--version")
56 # Print the Python version, bytesize and free-threading status.
57 session.run("python", "--version")
58 session.run("python", "-c", "import struct; print(struct.calcsize('P') * 8)")
59 session.run(
60 "python",
61 "-c",
62 "import sys; print(getattr(sys, '_is_gil_enabled', lambda: True)())",
63 )
64 # Print OpenSSL information.
65 session.run("python", "-m", "OpenSSL.debug")
66
67 memray_supported = True
68 if implementation_name != "cpython" or release_level != "final" or free_threading:
69 memray_supported = False
70 elif sys.platform == "win32":
71 memray_supported = False
72

Callers 5

testFunction · 0.85
test_integrationFunction · 0.85
test_min_pyopensslFunction · 0.85
test_brotlipyFunction · 0.85
emscriptenFunction · 0.85

Calls 2

installMethod · 0.80
runMethod · 0.45

Tested by 3

test_integrationFunction · 0.68
test_min_pyopensslFunction · 0.68
test_brotlipyFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…