Spaces:
Sleeping
Sleeping
Download tests/test_codegen.py from JonCard/infiniteradio: direct link, hf CLI and curl.
- Browser
- Download file 714 Bytes
-
https://huggingface.co/spaces/JonCard/infiniteradio/resolve/main/tests/test_codegen.py
- Command line
-
hf download hf://spaces/JonCard/infiniteradio/tests/test_codegen.py
-
curl -L -o test_codegen.py https://huggingface.co/spaces/JonCard/infiniteradio/resolve/main/tests/test_codegen.py
714 Bytes
| import os | |
| import pathlib | |
| import subprocess | |
| import sys | |
| ROOT = pathlib.Path(__file__).parent.parent | |
| def test_generated_code_matches_api_definition(tmp_path): | |
| out = tmp_path / "generated" | |
| env = {**os.environ, "PATH": f"{pathlib.Path(sys.executable).parent}{os.pathsep}{os.environ['PATH']}"} | |
| subprocess.run([ROOT / "scripts" / "generate.sh", out], check=True, env=env, capture_output=True) | |
| committed = ROOT / "generated" | |
| for fresh in out.iterdir(): | |
| assert (committed / fresh.name).read_text() == fresh.read_text(), ( | |
| f"generated/{fresh.name} is stale; run scripts/generate.sh" | |
| ) | |
| assert {p.name for p in out.iterdir()} == {p.name for p in committed.glob("*.py")} | |