예제 #1
0
def test_gridrunner(runner):
    """Load a gridtest runner and test for a basic file.
    """
    assert "basic" in runner.config
    assert len(runner.config["basic"]["tests"]) >= 5
    assert runner.run() == 0
    assert runner.run(parallel=False) == 0

    # Test gridrunner with temporary substitutes
    from gridtest.main.test import GridRunner

    test_file = os.path.join(here, "modules", "temp-tests.yml")
    runner = GridRunner(test_file)
    assert "temp" in runner.config
    assert len(runner.config["temp"]["tests"]) >= 2
    assert runner.run() == 0
    assert runner.run(parallel=False) == 0
예제 #2
0
def test_metrics():
    """Test that gridtest can load metrics specifications
    """
    from gridtest.main.test import GridRunner

    test_file = os.path.join(here, "modules", "metrics.yml")
    runner = GridRunner(test_file)
    tests = runner.get_tests()

    # List and min/max should expand to 3
    assert (len([x for x in tests.keys() if "gotosleep" in x])) == 3
    runner.run()

    # Ensure that invalid specs aren't honored
    runner = GridRunner(test_file)
    runner.config["metrics"]["tests"]["metrics.gotosleep"][0]["args"][
        "seconds"]["invalid"] = 1

    with pytest.raises(SystemExit):
        tests = runner.get_tests()
예제 #3
0
def main(args, extra):

    runner = GridRunner(args.filename)
    return_code = runner.run(
        nproc=args.nproc,
        parallel=not args.serial,
        verbose=args.verbose,
        regexp=args.pattern,
        name=args.name,
        interactive=args.interactive,
        cleanup=not args.no_cleanup,
        save=args.save,
        save_compact=args.save_compact,
        save_report=args.save_report,
        report_template=args.report_template,
        save_metrics=args.save_metrics,
    )
    sys.exit(return_code)