Skip to content

Commit 91587da

Browse files
committed
Speed up tests
1 parent fe6fe38 commit 91587da

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.github/workflows/test-python.yml

+17
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@ jobs:
2929
run: pip install --upgrade pip hatch uv
3030
- name: Run Single DB Tests
3131
run: hatch test --python ${{ matrix.python-version }} --ds=test_app.settings_single_db -v
32+
33+
python-source-multi-db:
34+
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
python-version: ["3.9", "3.10", "3.11", "3.12"]
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: oven-sh/setup-bun@v2
41+
with:
42+
bun-version: latest
43+
- name: Use Python ${{ matrix.python-version }}
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
- name: Install Python Dependencies
48+
run: pip install --upgrade pip hatch uv
3249
- name: Run Multi-DB Tests
3350
run: hatch test --python ${{ matrix.python-version }} --ds=test_app.settings_multi_db -v
3451

src/reactpy_django/templatetags/reactpy.py

-3
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ def component(
145145
_logger.error(msg)
146146
return failure_context(dotted_path, ComponentCarrierError(msg))
147147

148-
# Call `dir` before prerendering to make sure the user object is loaded
149-
dir(request.user)
150-
151148
_prerender_html = prerender_component(user_component, args, kwargs, uuid, request)
152149

153150
# Fetch the offline component's HTML, if requested

src/reactpy_django/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ def prerender_component(
398398
search = request.GET.urlencode()
399399
scope = getattr(request, "scope", {})
400400
scope["reactpy"] = {"id": str(uuid)}
401+
dir(request.user) # Call `dir` before prerendering to make sure the user object is loaded
401402

402403
with SyncLayout(
403404
ConnectionContext(

0 commit comments

Comments
 (0)