Skip to content

Tests and examples rewrite filestore/db/S1/overlays.svg in the working tree #696

Description

@mvdoc

Running quickflat-based tests or examples (e.g. pytest cortex/tests/test_quickflat.py, examples/datasets/plot_data_with_alpha.py) against the bundled filestore leaves filestore/db/S1/overlays.svg modified (a ~880-line diff: the file is re-serialized with pretty_print=True, layers get re-added, etc.).

Cause: cortex.svgoverlay.get_overlay(..., modify_svg_file=True) is the default, and the "assure all layers are present" step plus the final etree.tostring(svg, pretty_print=True) write the overlay back to disk (cortex/svgoverlay.py around L752-770 and L885).

This is a footgun: git status is dirty after every test run, and it is easy to accidentally commit the rewritten file (see 7b8ddd1 / d04acd7 for how painful this file is in history).

Suggestions:

  • tests/examples should never write into the tracked filestore — e.g. a session fixture that copies filestore/db to a temp dir and points cortex.options/db.filestore at it, or calling get_overlay with modify_svg_file=False;
  • and/or make get_overlay only write when the SVG content actually changed (no rewrite just for pretty-printing).

🤖 Generated with Claude Code

https://claude.ai/code/session_01KdjyZMFXsn6mRMJu9i8ige

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions