def test_existing_empty_env(self, empty_env_name): msg = ( f"`benchopt` is not installed in existing env '{empty_env_name}'") with pytest.raises(RuntimeError, match=msg): install([str(DUMMY_BENCHMARK_PATH), '--env-name', empty_env_name], 'benchopt', standalone_mode=False)
def test_invalid_dataset(self): with pytest.raises(click.BadParameter, match=r"invalid_dataset"): install([ str(DUMMY_BENCHMARK_PATH), '-d', 'invalid_dataset', '-s', 'pgd' ], 'benchopt', standalone_mode=False)
def test_benchopt_install(self): with CaptureRunOutput() as out: install( [str(DUMMY_BENCHMARK_PATH), '-d', SELECT_ONE_SIMULATED, '-s', SELECT_ONE_PGD, '-y'], 'benchopt', standalone_mode=False ) out.check_output(f"Installing '{DUMMY_BENCHMARK.name}' requirements") out.check_output("already available\n", repetition=2)
def test_benchopt_install_in_env_with_requirements(self, test_env_name): objective = REQUIREMENT_BENCHMARK.get_benchmark_objective() out = 'already installed but failed to import.' if not objective.is_installed(env_name=test_env_name): with CaptureRunOutput() as out: install([ str(REQUIREMENT_BENCHMARK_PATH), '--env-name', test_env_name ], 'benchopt', standalone_mode=False) assert objective.is_installed(env_name=test_env_name), out # XXX: run the bench with CaptureRunOutput() as out: with pytest.raises(SystemExit, match='False'): run_cmd = [ str(REQUIREMENT_BENCHMARK_PATH), '--env-name', test_env_name, '-n', '10', '-r', '1', '--no-plot' ] run(run_cmd, 'benchopt', standalone_mode=False) out.check_output(r"done \(not enough run\)", repetition=1)
def test_invalid_benchmark(self, invalid_benchmark, match): with pytest.raises(click.BadParameter, match=match): install([invalid_benchmark], 'benchopt', standalone_mode=False)