Spaces:
Sleeping
Sleeping
import warnings | |
import click | |
from ..test import get_runtests_cli, runtests, runtests_jax, runtests_torch | |
def pysr(context): | |
ctx = context | |
def _install(julia_project, quiet, precompile): | |
warnings.warn( | |
"This command is deprecated. Julia dependencies are now installed at first import." | |
) | |
TEST_OPTIONS = {"main", "jax", "torch", "cli"} | |
def _tests(tests): | |
"""Run part of the PySR test suite. | |
Choose from main, jax, torch, and cli. | |
""" | |
if len(tests) == 0: | |
raise click.UsageError( | |
"At least one test must be specified. " | |
+ "The following are available: " | |
+ ", ".join(TEST_OPTIONS) | |
+ "." | |
) | |
else: | |
for test in tests: | |
if test in TEST_OPTIONS: | |
if test == "main": | |
runtests() | |
elif test == "jax": | |
runtests_jax() | |
elif test == "torch": | |
runtests_torch() | |
elif test == "cli": | |
runtests_cli = get_runtests_cli() | |
runtests_cli() | |
else: | |
warnings.warn(f"Invalid test {test}. Skipping.") | |