Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546"""The bundle staged on a remote host holds the python sources and nothing atool left in the tree: a cache directory would travel to every host, andshipping it changed what the host runs from."""
import iofrom pathlib import Pathimport sysimport tarfileimport tempfileimport unittestfrom unittest import mock
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "priv" / "python"))import albedo_bundle # noqa: E402import albedo_ssh # noqa: E402
class ArchiveTest(unittest.TestCase): def test_sources_travel_and_caches_do_not(self): with tempfile.TemporaryDirectory() as scratch: root = Path(scratch) for name in ( "a.py", "plugins/b.py", "plugins/__pycache__/b.cpython-314.pyc", ".ruff_cache/0.16.10/entry", "plugins/.mypy_cache/meta.json", ): path = root / name path.parent.mkdir(parents=True, exist_ok=True) path.write_text("x") with mock.patch.object(albedo_bundle, "ROOT", root): data = albedo_ssh.archive() names = { name.removeprefix("./") for name in tarfile.open(fileobj=io.BytesIO(data)).getnames() } self.assertEqual( {name for name in names if not name.endswith(("plugins", "."))}, {"a.py", "plugins/b.py"}, )
if __name__ == "__main__": unittest.main()