Skip to content

Commit f3c0ee8

Browse files
committed
semi-functional test runner with hatch
1 parent 4a746be commit f3c0ee8

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
- name: Install Python Dependencies
2929
run: pip install --upgrade pip hatch uv
3030
- name: Run Tests
31-
run: hatch test --python ${{ matrix.python-version }}
31+
run: hatch run test:python --python ${{ matrix.python-version }}

pyproject.toml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ path = "src/reactpy_django/__init__.py"
5757

5858
[tool.hatch.build.targets.sdist]
5959
include = ["/src"]
60-
artifacts = ["/src/reactpy_django/static/client.js"]
60+
artifacts = ["/src/reactpy_django/static/"]
6161

6262
[tool.hatch.build.targets.wheel]
63-
artifacts = ["/src/reactpy_django/static/client.js"]
63+
artifacts = ["/src/reactpy_django/static/"]
6464

6565
[tool.hatch.metadata]
6666
license-files = { paths = ["LICENSE.md"] }
@@ -71,26 +71,31 @@ installer = "uv"
7171
[[tool.hatch.build.hooks.build-scripts.scripts]]
7272
commands = [
7373
"bun install --cwd src/js",
74-
"bun build src/js/src/index.tsx --outfile src/reactpy_django/static/client.js --minify",
75-
'cd scripts && python copy_dir.py "src/js/node_modules/@pyscript/core/dist" "src/reactpy_django/static/pyscript"',
76-
'cd scripts && python copy_dir.py "src/js/node_modules/morphdom/dist" "src/reactpy_django/static/morphdom"',
74+
"bun build src/js/src/index.tsx --outfile src/reactpy_django/static/reactpy_django/client.js --minify",
75+
'cd src/build_scripts && python copy_dir.py "src/js/node_modules/@pyscript/core/dist" "src/reactpy_django/static/reactpy_django/pyscript"',
76+
'cd src/build_scripts && python copy_dir.py "src/js/node_modules/morphdom/dist" "src/reactpy_django/static/reactpy_django/morphdom"',
7777
]
7878
artifacts = []
7979

8080
# >>> Hatch Test Suite <<<
81-
82-
[tool.hatch.envs.hatch-test]
81+
[tool.hatch.envs.test]
82+
detached = true
8383
extra-dependencies = [
8484
"playwright",
8585
"twisted",
8686
"channels[daphne]>=4.0.0",
8787
"tblib",
8888
"whitenoise", # TODO: Switch to ServeStatic
8989
]
90-
matrix-name-format = "{variable}-{value}"
9190

92-
[[tool.hatch.envs.hatch-test.matrix]]
93-
python = ["3.9", "3.10", "3.11", "3.12"]
91+
[tool.hatch.envs.test.scripts]
92+
python = [
93+
"pip install -e . -U",
94+
"playwright install chromium",
95+
"cd tests && python manage.py test --noinput --settings='test_app.settings_single_db'",
96+
"cd tests && python manage.py test --noinput --settings='test_app.settings_multi_db'",
97+
]
98+
9499

95100
# >>> Hatch Documentation Scripts <<<
96101

src/build_scripts/copy_dir.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ def copy_files(source: Path, destination: Path) -> None:
2020
print("Usage: python copy_dir.py <source_dir> <destination>")
2121
sys.exit(1)
2222

23-
src = Path(sys.argv[1])
24-
dest = Path(sys.argv[2])
23+
root_dir = Path(__file__).parent.parent.parent
24+
src = Path(root_dir / sys.argv[1])
25+
dest = Path(root_dir / sys.argv[2])
2526

2627
if not src.exists():
2728
print(f"Source directory {src} does not exist")

0 commit comments

Comments
 (0)