Fix About Paint dialog test failing due to version string changes

Make version info static when running in pytest.

I also tried adding in test_snapshots.py:

    import textual_paint
    textual_paint.__version__ = "snapshot test edition 1"

    import textual_paint.__init__ as init
    init.__version__ = "snapshot test edition 2"

which seemed to have no effect.

Since I already have special case logic for __version__ in __init__.py,
I'm reasonably happy with this solution.
This commit is contained in:
Isaiah Odhner 2023-09-08 23:56:18 -04:00
parent 9f12ba7833
commit 2e89e73f37
2 changed files with 349 additions and 340 deletions

View File

@ -17,5 +17,14 @@ from subprocess import check_output
DEVELOPMENT = exists(dirname(__file__) + "/../../.git")
"""Whether running from a Git repository."""
import sys
PYTEST = "pytest" in sys.modules
"""Whether running from pytest."""
if DEVELOPMENT:
__version__ = "development " + check_output(["git", "describe", "--tags"], cwd=dirname(__file__)).strip().decode()
if PYTEST:
# Avoid version string in About Paint dialog affecting snapshots.
__version__ = "snapshot test edition :)"

File diff suppressed because one or more lines are too long