The upstream release tree, every tracked file byte for byte, from https://github.com/VecSzn/PolyStrata at tag v0.1.45-poly.1, commit d0cd84dc6bd009d1d9e2191e4e28cc76b80f1ee3. Nothing added, removed or edited; git diff against this commit is the whole story of the fork. Verified: the commit's tree hash equals the upstream commit's tree hash.
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
"""The files tools/polystrata_names.py reads say PolyStrata where they mean this project. A text that means the
|
|
project this one is built on names it by a link or as "the Strata project": the tool leaves those alone, and
|
|
the bare word it would turn into PolyStrata the next time it runs.
|
|
|
|
python -m unittest tools.test_polystrata_names
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import contextlib
|
|
import io
|
|
import subprocess
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
from unittest import mock
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / "tools"))
|
|
import polystrata_names as N # noqa: E402
|
|
|
|
|
|
class Names(unittest.TestCase):
|
|
def test_examples(self):
|
|
N.demo()
|
|
|
|
def test_nothing_is_left_to_rename(self):
|
|
files = io.StringIO()
|
|
try:
|
|
with mock.patch.object(sys, "argv", ["polystrata_names.py", "--check"]), \
|
|
contextlib.redirect_stdout(files), contextlib.redirect_stderr(io.StringIO()):
|
|
left = N.main()
|
|
except (OSError, subprocess.CalledProcessError):
|
|
self.skipTest("the tool lists the files with git: this is no checkout")
|
|
self.assertEqual(left, 0, "python tools/polystrata_names.py --check lists:\n" + files.getvalue())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|