Skip to content

Commit b422cd9

Browse files
committed
test suite fixes
1 parent ffc7f38 commit b422cd9

File tree

3 files changed

+24
-90
lines changed

3 files changed

+24
-90
lines changed

.github/workflows/test.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,19 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: ["3.7", "3.8", "3.9", "3.10"]
16+
python-version: ["3.9", "3.10", "3.11"]
1717
steps:
1818
- uses: actions/checkout@v2
19-
- uses: nanasess/setup-chromedriver@master
2019
- uses: actions/setup-node@v2-beta
2120
with:
22-
node-version: "12"
23-
- name: Install latest NPM
24-
run: |
25-
npm install -g npm@latest
26-
npm --version
21+
node-version: "14"
22+
- name: install NPM version
23+
run: npm install -g [email protected]
2724
- name: Use Python ${{ matrix.python-version }}
2825
uses: actions/setup-python@v2
2926
with:
3027
python-version: ${{ matrix.python-version }}
3128
- name: Create Repo From Template
3229
run: |
3330
pip install nox
34-
nox -s test
31+
nox -t test

noxfile.py

Lines changed: 19 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
from contextlib import contextmanager
2-
from functools import wraps
31
from pathlib import Path
42
from shutil import rmtree
5-
from tempfile import TemporaryDirectory
63
from typing import Callable
74

85
from nox import Session, session
@@ -14,66 +11,25 @@
1411
SessionFunc = Callable[[Session], None]
1512

1613

17-
def build_test_repo(install: bool = True) -> Callable[[SessionFunc], SessionFunc]:
18-
"""Build a test repo from test-config.yaml before a session"""
19-
20-
def decorator(session_func: SessionFunc) -> SessionFunc:
21-
@wraps(session_func)
22-
def wrapper(session: Session) -> None:
23-
_build_test_repo(session, install)
24-
return session_func(session)
25-
26-
return wrapper
27-
28-
return decorator
29-
30-
31-
def install_latest_reactpy(session_func: SessionFunc) -> SessionFunc:
32-
# install the latest version of ReactPy by pulling it from the main repo
33-
34-
@wraps(session_func)
35-
def wrapper(session: Session) -> None:
36-
try:
37-
session.run(
38-
"git",
39-
"clone",
40-
"https://github.com/reactive-python/reactpy.git",
41-
external=True,
42-
)
43-
session.install("./reactpy[testing,starlette]")
44-
session_func(session)
45-
finally:
46-
reactpy_dir = HERE / "reactpy"
47-
if reactpy_dir.exists():
48-
rmtree(reactpy_dir)
49-
50-
return wrapper
51-
52-
53-
@session
54-
def test(session: Session) -> None:
55-
session.notify("test_suite", posargs=session.posargs)
56-
session.notify("test_style")
57-
58-
59-
@session
60-
@build_test_repo()
61-
@install_latest_reactpy
14+
@session(tags=["test"])
6215
def test_suite(session: Session) -> None:
16+
build_test_repo(session)
17+
install_latest_reactpy(session)
6318
session.chdir("test-repo")
6419
session.run("playwright", "install", "chromium")
6520
session.run("pytest", "tests", "--import-mode=importlib", *session.posargs)
6621

6722

68-
@session
69-
@build_test_repo(install=False)
23+
@session(tags=["test"])
7024
def test_style(session: Session) -> None:
25+
build_test_repo(session, install=False)
7126
session.install("black", "flake8")
7227
session.run("black", "--check", "test-repo", *list(map(str, HERE.glob("*.py"))))
7328
session.run("flake8", "test-repo")
7429

7530

76-
def _build_test_repo(session: Session, install: bool) -> None:
31+
def build_test_repo(session: Session, install: bool = True) -> None:
32+
"""Build a test repo from test-config.yaml"""
7733
# Need to remove node_modules so cookiecutter doesn't think since the cookiecutter
7834
# will try to format those files if present
7935
for path in TEMPLATE_DIR.rglob("node_modules"):
@@ -94,3 +50,15 @@ def _build_test_repo(session: Session, install: bool) -> None:
9450
session.install(".")
9551
session.install("-r", "requirements.txt")
9652
session.chdir("..")
53+
54+
55+
def install_latest_reactpy(session: Session) -> SessionFunc:
56+
# install the latest version of ReactPy by pulling it from the main repo
57+
try:
58+
session.install(
59+
"reactpy[testing,starlette] @ git+https://github.com/reactive-python/reactpy"
60+
)
61+
finally:
62+
reactpy_dir = HERE / "reactpy"
63+
if reactpy_dir.exists():
64+
rmtree(reactpy_dir)

0 commit comments

Comments
 (0)