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.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869"""Run every cross-language contract, both directions, from built beams.
python3 test/contract/run.py [contract ...]
The Gleam-driven properties run in one `erl` (`albedo/contract/runner.main`)against one Python peer (`peer.py`). The Python-driven properties are the`*_test.py` files here, each against one Gleam peer. Neither starts a processper case. With no names, every contract runs.
The beams come from `test/beams.py`: the gate's daemon snapshot, or else thecheckout built first, so a run never loads beams older than its source. See robot-docs/testing.md#cross-language-contracts."""
import argparseimport osfrom pathlib import Pathimport subprocessimport sys
HERE = Path(__file__).resolve().parentsys.path.insert(0, str(HERE))sys.path.insert(0, str(HERE.parent))
import beams # noqa: E402from support import ROOT # noqa: E402
def main() -> int: parser = argparse.ArgumentParser() parser.add_argument("contracts", nargs="*") args = parser.parse_args() ebins = beams.ebins() env = dict( os.environ, ALBEDO_CONTRACT_EBIN=os.pathsep.join(ebins), ALBEDO_CONTRACT_PYTHON=sys.executable, ALBEDO_CONTRACT_PEER=str(HERE / "peer.py"), ALBEDO_CONTRACTS=",".join(args.contracts), ) erl = ["erl"] for directory in ebins: erl += ["-pa", directory] gleam = subprocess.Popen( [*erl, "-noshell", "-noinput", "-eval", "albedo@contract@runner:main()"], env=env, ) tests = sorted( str(path) for path in HERE.glob("*_test.py") if not args.contracts or path.name.removesuffix("_test.py") in args.contracts ) python = 0 if tests: python = subprocess.run( [ sys.executable, str(ROOT / "test" / "python_test_runner.py"), "--jobs", str(len(tests)), *tests, ], env=env, ).returncode return 1 if gleam.wait() or python else 0
if __name__ == "__main__": sys.exit(main())