Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,037 changes: 1,037 additions & 0 deletions .codspeed/results_1737338906383.json

Large diffs are not rendered by default.

1,143 changes: 1,143 additions & 0 deletions .codspeed/results_1737339049018.json

Large diffs are not rendered by default.

1,143 changes: 1,143 additions & 0 deletions .codspeed/results_1737339073664.json

Large diffs are not rendered by default.

1,143 changes: 1,143 additions & 0 deletions .codspeed/results_1737339094692.json

Large diffs are not rendered by default.

1,143 changes: 1,143 additions & 0 deletions .codspeed/results_1737339206717.json

Large diffs are not rendered by default.

1,143 changes: 1,143 additions & 0 deletions .codspeed/results_1737339242040.json

Large diffs are not rendered by default.

1,143 changes: 1,143 additions & 0 deletions .codspeed/results_1737339334189.json

Large diffs are not rendered by default.

1,143 changes: 1,143 additions & 0 deletions .codspeed/results_1737339367654.json

Large diffs are not rendered by default.

44 changes: 28 additions & 16 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,30 @@ jobs:
run-poetry-install: true
create-venv-at-path: .venv
- name: Run unit tests
run: |
export PYTHONUNBUFFERED=1
poetry run pytest tests/units --cov --no-cov-on-fail --cov-report=
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: |
export PYTHONUNBUFFERED=1
poetry run pytest tests/units --cov --no-cov-on-fail --codspeed --cov-report= --cov-fail-under=40
- name: Run unit tests w/ redis
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
export PYTHONUNBUFFERED=1
export REDIS_URL=redis://localhost:6379
poetry run pytest tests/units --cov --no-cov-on-fail --cov-report=
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: |
export PYTHONUNBUFFERED=1
export REDIS_URL=redis://localhost:6379
poetry run pytest tests/units --cov --no-cov-on-fail --codspeed --cov-report= --cov-fail-under=40
# Change to explicitly install v1 when reflex-hosting-cli is compatible with v2
- name: Run unit tests w/ pydantic v1
run: |
export PYTHONUNBUFFERED=1
poetry run uv pip install "pydantic~=1.10"
poetry run pytest tests/units --cov --no-cov-on-fail --cov-report=
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: |
export PYTHONUNBUFFERED=1
poetry run uv pip install "pydantic~=1.10"
poetry run pytest tests/units --cov --no-cov-on-fail --codspeed --cov-report= --cov-fail-under=40
- name: Generate coverage report
run: poetry run coverage html

Expand All @@ -105,9 +114,12 @@ jobs:
- name: Run unit tests
run: |
export PYTHONUNBUFFERED=1
poetry run pytest tests/units --cov --no-cov-on-fail --cov-report=
poetry run pytest tests/units --cov --no-cov-on-fail --cov-report= --cov-fail-under=40
- name: Run unit tests w/ pydantic v1
run: |
export PYTHONUNBUFFERED=1
poetry run uv pip install "pydantic~=1.10"
poetry run pytest tests/units --cov --no-cov-on-fail --cov-report=
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: |
export PYTHONUNBUFFERED=1
poetry run uv pip install "pydantic~=1.10"
poetry run pytest tests/units --cov --no-cov-on-fail --cov-report= --cov-fail-under=40
2 changes: 1 addition & 1 deletion benchmarks/benchmark_compile_times.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ def main():
pr_id=args.pr_id,
)


if __name__ == "__main__":
main()

5 changes: 0 additions & 5 deletions benchmarks/benchmark_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import os
from pathlib import Path

from utils import send_data_to_posthog


def extract_stats_from_json(json_file: str) -> dict:
"""Extracts the stats from the JSON data and returns them as dictionaries.
Expand Down Expand Up @@ -66,9 +64,6 @@ def insert_benchmarking_data(
"app_name": app_name,
}

send_data_to_posthog("import_benchmark", properties)


def main():
"""Runs the benchmarks and inserts the results."""
# Get the commit SHA and JSON directory from the command line arguments
Expand Down
35 changes: 34 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ selenium = ">=4.11.0,<5.0"
pytest-benchmark = ">=4.0.0,<6.0"
playwright = ">=1.46.0"
pytest-playwright = ">=0.5.1"
pytest-codspeed = "^3.1.2"

[tool.poetry.scripts]
reflex = "reflex.reflex:cli"
Expand Down
19 changes: 19 additions & 0 deletions test_benchmark_imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest
from benchmarks.benchmark_imports import extract_stats_from_json

@pytest.mark.benchmark
def test_extract_stats_from_json(benchmark):
# Example JSON data
json_data = '{"results": [{"mean": 1.0, "stddev": 0.1, "median": 1.0, "min": 0.9, "max": 1.1}]}'

# Benchmark the extract_stats_from_json function
result = benchmark(extract_stats_from_json, json_data)

# Assert the result to ensure correctness
assert result == {
"mean": 1.0,
"stddev": 0.1,
"median": 1.0,
"min": 0.9,
"max": 1.1
}
Loading