Exemple #1
0
 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"])
Exemple #2
0
 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()
Exemple #3
0
 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"
Exemple #4
0
 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, [])
Exemple #5
0
 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"])