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

Run tests on 3.12-dev #2809

Closed
wants to merge 19 commits into from
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- uses: actions/checkout@v3
- uses: wntrblm/nox@main
with:
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11"
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11, 3.12"

- name: Pip and nox cache
id: cache
Expand All @@ -64,11 +64,11 @@ jobs:
~/.nox
.nox
key:
${{ runner.os }}-nox-${{ matrix.session.session }}-${{
${{ runner.os }}-nox-2-${{ matrix.session.session }}-${{
hashFiles('**/poetry.lock') }}-${{ hashFiles('**/noxfile.py') }}
restore-keys: |
${{ runner.os }}-nox-${{ matrix.session.session }}-
${{ runner.os }}-nox-
${{ runner.os }}-nox-2-${{ matrix.session.session }}-
${{ runner.os }}-nox-2-

- run: pipx install coverage
- run: pipx install poetry
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
- uses: actions/checkout@v3
- uses: wntrblm/nox@main
with:
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11"
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11, 3.12"

- name: Pip and nox cache
id: cache
Expand All @@ -132,7 +132,7 @@ jobs:
~/.nox
.nox
key:
${{ runner.os }}-nox-lint-${{ matrix.session.session }}-${{
${{ runner.os }}-nox-2-lint-${{ matrix.session.session }}-${{
hashFiles('**/poetry.lock') }}-${{ hashFiles('**/noxfile.py') }}
restore-keys: |
${{ runner.os }}-lint-nox-${{ matrix.session.session }}-
Expand Down Expand Up @@ -161,11 +161,11 @@ jobs:
~/.nox
.nox
key:
${{ runner.os }}-nox-windows-${{ hashFiles('**/poetry.lock') }}-${{
${{ runner.os }}-nox-2-windows-${{ hashFiles('**/poetry.lock') }}-${{
hashFiles('**/noxfile.py') }}
restore-keys: |
${{ runner.os }}-nox-windows
${{ runner.os }}-nox-
${{ runner.os }}-nox-2-windows
${{ runner.os }}-nox-2-

- run: pipx install poetry
- run: pipx inject nox nox-poetry
Expand Down
86 changes: 72 additions & 14 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,50 @@
import nox
from nox_poetry import Session, session

PYTHON_VERSIONS = ["3.11", "3.10", "3.9", "3.8", "3.7"]
PYTHON_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8"]


@session(python=PYTHON_VERSIONS, name="Tests", tags=["tests"])
def tests(session: Session) -> None:
session.run_always("poetry", "install", external=True)

markers_to_skip = [
"starlette",
"django",
"starlite",
"pydantic",
"sanic",
"aiohttp",
]

skip_markers = [["-m", f"not {marker}"] for marker in markers_to_skip]
skip_markers = [item for sublist in skip_markers for item in sublist]

session.run(
*[
"pytest",
"--cov=strawberry",
"--cov-append",
"--cov-report=xml",
"-n",
"auto",
"--showlocals",
"-vv",
*skip_markers,
"--ignore=tests/aiohttp",
"--ignore=tests/mypy",
"--ignore=tests/pyright",
]
)


@session(python=["3.11"], name="Django tests", tags=["tests"])
@nox.parametrize("django", ["4.2.0", "4.1.0", "4.0.0", "3.2.0"])
def tests_django(session: Session, django: str) -> None:
session.run_always("poetry", "install", external=True)

session._session.install(f"django~={django}") # type: ignore

session.run(
"pytest",
"--cov=strawberry",
Expand All @@ -18,24 +55,39 @@ def tests(session: Session) -> None:
"--showlocals",
"-vv",
"-m",
"not starlette",
"-m",
"not django",
"-m",
"not starlite",
"django",
"--ignore=tests/aiohttp",
)


@session(python=["3.11"], name="Aiohttp tests", tags=["tests"])
@nox.parametrize("aiohttp", ["3.8.4"])
def tests_aiohttp(session: Session, aiohttp: str) -> None:
session.run_always("poetry", "install", external=True)

session._session.install(f"aiohttp~={aiohttp}") # type: ignore
session._session.install("pytest-aiohttp") # type: ignore

session.run(
"pytest",
"--cov=strawberry",
"--cov-append",
"--cov-report=xml",
"-n",
"auto",
"--showlocals",
"-vv",
"-m",
"not pydantic",
"--ignore=tests/mypy",
"--ignore=tests/pyright",
"aiohttp",
)


@session(python=["3.11"], name="Django tests", tags=["tests"])
@nox.parametrize("django", ["4.2.0", "4.1.0", "4.0.0", "3.2.0"])
def tests_django(session: Session, django: str) -> None:
@session(python=["3.11"], name="Sanic tests", tags=["tests"])
@nox.parametrize("sanic", ["23.3.0"])
def tests_sanic(session: Session, sanic: str) -> None:
session.run_always("poetry", "install", external=True)

session._session.install(f"django~={django}") # type: ignore
session._session.install(f"sanic~={sanic}") # type: ignore

session.run(
"pytest",
Expand All @@ -47,7 +99,8 @@ def tests_django(session: Session, django: str) -> None:
"--showlocals",
"-vv",
"-m",
"django",
"sanic",
"--ignore=tests/aiohttp",
)


Expand All @@ -69,6 +122,7 @@ def tests_starlette(session: Session, starlette: str) -> None:
"-vv",
"-m",
"starlette",
"--ignore=tests/aiohttp",
)


Expand All @@ -87,6 +141,7 @@ def tests_litestar(session: Session) -> None:
"-vv",
"-m",
"starlite",
"--ignore=tests/aiohttp",
)


Expand All @@ -109,6 +164,7 @@ def test_pydantic(session: Session, pydantic: str) -> None:
"-vv",
"-m",
"pydantic",
"--ignore=tests/aiohttp",
)


Expand All @@ -123,6 +179,7 @@ def tests_mypy(session: Session) -> None:
"--cov-report=xml",
"tests/mypy",
"-vv",
"--ignore=tests/aiohttp",
)


Expand All @@ -138,6 +195,7 @@ def tests_pyright(session: Session) -> None:
"--cov-report=xml",
"tests/pyright",
"-vv",
"--ignore=tests/aiohttp",
)


Expand Down
Loading