Skip to content

feat: snapshot tests #296

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ format:
lock:
CUSTOM_COMPILE_COMMAND="make lock" uv pip compile --upgrade --generate-hashes requirements/base.in -o requirements.txt

lock-package:
CUSTOM_COMPILE_COMMAND="make lock" uv pip compile --upgrade-package $(PACKAGE) --generate-hashes --emit-build-options requirements/base.in requirements/deploy.in -o requirements.txt

lock-dev:
CUSTOM_COMPILE_COMMAND="make lock-dev" uv pip compile --upgrade --generate-hashes requirements/dev.in -o requirements-dev.txt

lock-dev-package:
CUSTOM_COMPILE_COMMAND="make lock-dev" uv pip compile --upgrade-package $(PACKAGE) --generate-hashes requirements/dev.in -o requirements-dev.txt

build:
echo "Building TK..."

Expand All @@ -35,9 +41,16 @@ clean:

test: clean check_rebuild
if [ -z "$(PATTERN)" ]; then \
$(DC_RUN_CMD) pytest soil_id; \
$(DC_RUN_CMD) pytest soil_id -vv; \
else \
$(DC_RUN_CMD) pytest soil_id -vv -k $(PATTERN); \
fi

test_update_snapshots: clean check_rebuild
if [ -z "$(PATTERN)" ]; then \
$(DC_RUN_CMD) pytest soil_id --snapshot-update; \
else \
$(DC_RUN_CMD) pytest soil_id -k $(PATTERN); \
$(DC_RUN_CMD) pytest soil_id --snapshot-update -k $(PATTERN); \
fi

test-verbose:
Expand Down
5 changes: 5 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ pytest==8.4.1 \
# via
# -r requirements/dev.in
# pytest-profiling
# syrupy
pytest-profiling==1.8.1 \
--hash=sha256:3dd8713a96298b42d83de8f5951df3ada3e61b3e5d2a06956684175529e17aea \
--hash=sha256:3f171fa69d5c82fa9aab76d66abd5f59da69135c37d6ae5bf7557f1b154cb08d
Expand Down Expand Up @@ -265,6 +266,10 @@ soupsieve==2.7 \
--hash=sha256:6e60cc5c1ffaf1cebcc12e8188320b72071e922c2e897f737cadce79ad5d30c4 \
--hash=sha256:ad282f9b6926286d2ead4750552c8a6142bc4c783fd66b0293547c8fe6ae126a
# via beautifulsoup4
syrupy==4.9.1 \
--hash=sha256:b7d0fcadad80a7d2f6c4c71917918e8ebe2483e8c703dfc8d49cdbb01081f9a4 \
--hash=sha256:b94cc12ed0e5e75b448255430af642516842a2374a46936dd2650cfb6dd20eda
# via -r requirements/dev.in
tqdm==4.67.1 \
--hash=sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2 \
--hash=sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2
Expand Down
1 change: 1 addition & 0 deletions requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ruff
pre-commit
pytest
pytest-profiling
syrupy
3 changes: 2 additions & 1 deletion soil_id/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ def extract_hwsd2_data(connection, lon, lat, buffer_dist, table_name):
BOOL_OR(ST_Intersects(shape, {point})) AS pt_intersect
FROM hwsd2_segment
WHERE ST_DWithin(shape, {point}, {buffer_dist})
GROUP BY hwsd2_id;
GROUP BY hwsd2_id
ORDER BY hwsd2_id;
"""

# Use GeoPandas to execute the main query and load results into a GeoDataFrame.
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading