def test_fails_if_unknown_files_in_config_folder(self, fake_snakemake: Path, mocker: MockerFixture): o = fake_snakemake / "old-style" (o / "config" / "random").touch() with pytest.raises(RunError): output.retrofit_output(o, [o / "config/config.yaml"])
def test_fails_when_user_input_not_yes(self, fake_snakemake: Path, mocker: MockerFixture): o = fake_snakemake / "old-style" mocker.patch("builtins.input", return_value="") out = output.retrofit_output(o, [o / "config/config.yaml"]) assert out is False assert (o / "config").exists()
def test_successfully_retrofits(self, fake_snakemake: Path, mocker: MockerFixture): o = fake_snakemake / "old-style" mocker.patch("builtins.input", return_value="yes") out = output.retrofit_output(o, [o / "config/config.yaml"]) assert out is True assert not (o / "config").exists() assert dirlen(o / "app1") == 1 with (o / ".snakebids").open() as f: assert json.load(f)["mode"] == "bidsapp"
def test_fails_if_no_config_files_provided(self, fake_snakemake: Path, mocker: MockerFixture): o = fake_snakemake / "old-style" with pytest.raises(RunError): output.retrofit_output(o, [])
def test_fails_when_snakebids_file_exists(self, fake_snakemake: Path, mocker: MockerFixture): o = fake_snakemake / "old-style" (o / ".snakebids").touch() with pytest.raises(RunError): output.retrofit_output(o, [o / "config/config.yaml"])