Skip to content

chore: gitignore pytest-temp-preset.json test side-effect - #149

Merged
marceloprates merged 5 commits into
mainfrom
develop
Jul 30, 2026
Merged

chore: gitignore pytest-temp-preset.json test side-effect#149
marceloprates merged 5 commits into
mainfrom
develop

Conversation

@marceloprates

Copy link
Copy Markdown
Owner

Context

Running pytest tests/ (which exercises tests/test.py:28 test_create_and_read_preset) leaves behind an untracked file:

?? prettymaps/presets/pytest-temp-preset.json

The test calls prettymaps.create_preset('pytest-temp-preset', ...)
to write a real JSON file under prettymaps/presets/, and never
cleans it up. Every contributor who runs the test suite sees a
stray untracked file in git status until they manually delete it.

Fix

Add prettymaps/presets/pytest-temp-preset.json to .gitignore,
next to the existing prettymaps/presets/my-preset.json rule that
covers the user-facing preset convention.

Diff

 *.tmp
 *.tmp.png
 prettymaps/presets/my-preset.json
+prettymaps/presets/pytest-temp-preset.json

Verification

  • git check-ignore -v prettymaps/presets/pytest-temp-preset.json
    resolves the path to .gitignore:47.
  • pytest tests/ still passes (32/32 — the test logic is
    unchanged; only the gitignore surface area changed).

The dev container config was from the pre-PR-144 layout and is now stale:

- It pins Python 3.11, but setup.py requires >=3.12.
- It references prettymaps/app.py in customizations.codespaces.
  openFiles, but the Streamlit entrypoint is app.py at the repo root.
- The updateContentCommand runs a 'pip3 install --user streamlit'
  step that current CI no longer relies on.

The directory is not referenced from any active workflow or README
section. Removes the .devcontainer/ line from .gitignore too.

Pure housekeeping; no functional change.
PR #144 deleted the 13 temp_readme_*.png files that the
generate-readme.yml workflow had committed to
pictures/README/temp_readme_files/, but missed this single .svg
sibling (added 2025-05-16). After PR #144, pictures/README/
contained only this stale 3.5 KB file. Removing it leaves the
directory empty.

Pure housekeeping; no functional change.
.gitignore carried two rules for a scripts/ directory that does
not exist (the Streamlit entrypoint is app.py at the repo root,
and there is no other code generation pipeline):

    /scripts/*.pyc
    /scripts/__pycache__/

Both lines are removed.

Pure housekeeping; no functional change.
The Streamlit Cloud deploy was failing with:

    ImportError: libgthread-2.0.so.0: cannot open shared object file:
    No such file or directory

opencv-python 5.0.0.93 (allowed by the >=4.11.0.86 floor in
requirements.txt and pulled by uv on the latest deploy) links
against the GLib runtime at module load time. packages.txt ships
libgl1 (OpenGL runtime), but the GLib shared object is not present
on Streamlit Cloud's image, so the cv2 native module cannot load.

opencv-python-headless exposes the same cv2 namespace, drops the
Qt/GTK/GLib dependency tree entirely, and is the upstream-
recommended variant for headless / server deployments.

The only cv2 callsites in this codebase are cv2.resize and
cv2.bilateralFilter (prettymaps/draw.py, hillshade layer path).
Both work identically under headless; locally validated:

  - import cv2: 5.0.0.0
  - pytest tests/: 9 passed
  - pytest tests/test.py: 23 passed
  - streamlit run app.py boots clean
  - cv2.resize + cv2.bilateralFilter verified end-to-end

No source code change; packages.txt intentionally left as-is
(libgl1 is small and harmless; the GLib runtime is no longer
needed by anything we depend on).
tests/test.py:28 (test_create_and_read_preset) calls
prettymaps.create_preset('pytest-temp-preset', ...) and writes a
real JSON file into prettymaps/presets/pytest-temp-preset.json,
which then shows up as untracked in 'git status' after running
pytest. Add a one-line gitignore rule next to the existing
prettymaps/presets/my-preset.json entry so contributors running
the test suite locally don't see a stray untracked file.
@marceloprates
marceloprates merged commit 02f8587 into main Jul 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant