Skip to content

Commit

Permalink
Added tests to pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
w2ll2am committed May 11, 2023
1 parent 82f5f4d commit 92ac433
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions pysr/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
from .test_env import runtests as runtests_env
from .test_jax import runtests as runtests_jax
from .test_torch import runtests as runtests_torch
from .cliTest import runtests as runtests_cli
6 changes: 4 additions & 2 deletions pysr/test/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
parser.add_argument(
"test",
nargs="*",
help="Test to run. One or more of 'main', 'env', 'jax', 'torch'.",
help="Test to run. One or more of 'main', 'env', 'jax', 'torch', 'cli'.",
)

# Parse args:
Expand All @@ -25,7 +25,7 @@

# Run tests:
for test in tests:
if test in {"main", "env", "jax", "torch"}:
if test in {"main", "env", "jax", "torch", "cli"}:
cur_dir = os.path.dirname(os.path.abspath(__file__))
print(f"Running test from {cur_dir}")
if test == "main":
Expand All @@ -36,6 +36,8 @@
runtests_jax()
elif test == "torch":
runtests_torch()
elif test == "cli":
runtests_cli()
else:
parser.print_help()
raise SystemExit(1)
9 changes: 7 additions & 2 deletions pysr/test/cliTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,10 @@ def test_help_on_install(self):
self.assertEqual(expected, actual)


if __name__ == '__main__':
unittest.main()
def runtests():
"""Run all tests in cliTest.py."""
loader = unittest.TestLoader()
suite = unittest.TestSuite()
suite.addTests(loader.loadTestsFromTestCase(TestCli))
runner = unittest.TextTestRunner()
return runner.run(suite)

0 comments on commit 92ac433

Please sign in to comment.