diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-08 15:17:57 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-08 15:17:57 (GMT) |
commit | e1e17b4a5895852f23b7dd9a2d98be3cdd1c6272 (patch) | |
tree | 6c9c98ab948ea616c375f14cb0d178cd20936cb5 /commands | |
parent | 3f05816ea746124ca2b91842ba5f8bb5175c2068 (diff) |
Support running one test
Diffstat (limited to 'commands')
-rwxr-xr-x | commands/run-tests | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/commands/run-tests b/commands/run-tests index a9919df..3f92681 100755 --- a/commands/run-tests +++ b/commands/run-tests @@ -1,5 +1,6 @@ #!/usr/bin/python +import argparse import os import shutil import sys @@ -11,23 +12,33 @@ from devbot import test common.setup() -os.environ["SUGAR_LOGGER_LEVEL"] = "debug" -os.environ["SUGAR_PROFILE"] = "uitests" -os.environ["GTK_MODULES"] = "gail:atk-bridge" +def _run_ui_tests(): + profile_path = os.path.expanduser("~/.sugar/uitests") + shutil.rmtree(profile_path, ignore_errors=True) + + virtual = "SUGAR_BUILDBOT" in os.environ + test_path = os.path.join(common.tests_dir, "sugar", "shell.py") -if not test.test(): - sys.exit(1) + result = run.run_test("sugar-runner", test_path, virtual) -profile_path = os.path.expanduser("~/.sugar/uitests") -shutil.rmtree(profile_path, ignore_errors=True) + logs_path = os.path.join(profile_path, "logs") + run.collect_logs(logs_path, "test") -virtual = "SUGAR_BUILDBOT" in os.environ -test_path = os.path.join(common.tests_dir, "sugar", "shell.py") + if not result: + sys.exit(1) -result = run.run_test("sugar-runner", test_path, virtual) +parser = argparse.ArgumentParser() +parser.add_argument("module", nargs="?", help="name of the module to test") +args = parser.parse_args() + +os.environ["SUGAR_LOGGER_LEVEL"] = "debug" +os.environ["SUGAR_PROFILE"] = "uitests" +os.environ["GTK_MODULES"] = "gail:atk-bridge" -logs_path = os.path.join(profile_path, "logs") -run.collect_logs(logs_path, "test") +if args.module: + test.test_one(args.module) +else: + if not test.test(): + sys.exit(1) -if not result: - sys.exit(1) + _run_ui_tests() |