Beispiel #1
0
def test_load_configuration_from_file(tmp_path):
    config_file = Path(".").absolute()
    if config_file.name != "tests":
        config_file /= "tests"  # pragma: no cover
    config_file = config_file / "fixtures" / "test.conf"
    parser = _create_argument_parser()
    parsed = parser.parse_args(
        [
            f"@{config_file}",
            "--module_name",
            "hurz",
            "--project_path",
            str(tmp_path),
            "--output_path",
            str(tmp_path),
            "--budget",
            "50",
        ]
    )
    configuration = parsed.config
    expected = config.Configuration(
        algorithm=config.Algorithm.MOSA,
        seed=42,
        budget=50,
        configuration_id="merge checker",
        module_name="hurz",
        project_path=str(tmp_path),
        output_path=str(tmp_path),
    )
    assert configuration == expected
def reset_configuration():
    """Automatically reset the configuration singleton"""
    config.INSTANCE = config.Configuration(
        algorithm=config.Algorithm.RANDOOPY,
        project_path="",
        output_path="",
        module_name="",
    )
Beispiel #3
0
def test_integrate(tmp_path):
    project_path = Path(".").absolute()
    if project_path.name == "tests":
        project_path /= ".."  # pragma: no cover
    project_path = project_path / "docs" / "source" / "_static"
    configuration = config.Configuration(
        algorithm=config.Algorithm.MOSA,
        budget=1,
        module_name="example",
        output_path=str(tmp_path),
        project_path=str(project_path),
        report_dir=str(tmp_path),
        statistics_backend=config.StatisticsBackend.NONE,
    )
    gen.set_configuration(configuration)
    result = gen.run_pynguin()
    assert result == gen.ReturnCode.OK