wellcometrust / grants_tagger

Tag grants with MeSH and other tags
MIT License
14 stars 4 forks source link

Fix train fail in tox #154

Closed nsorros closed 2 years ago

nsorros commented 2 years ago

The train command fails with tox but not with pytest which is weird. The error is

def test_train_command():
        with tempfile.TemporaryDirectory() as tmp_dir:
            data_path = os.path.join(tmp_dir, "data.jsonl")
            model_path = os.path.join(tmp_dir, "model.pkl")
            label_binarizer_path = os.path.join(tmp_dir, "label_binarizer.pkl")
            train_info_path = os.path.join(tmp_dir, "train_info.json")

            write_jsonl(data_path, DATA)

            result = runner.invoke(app, [
                "train",
                data_path,
                model_path,
                label_binarizer_path,
                "--approach",
                "tfidf-svm",
                "--parameters",
                "{'tfidf__min_df': 1, 'tfidf__stop_words': None}",
            #    "--train-info",
            #    train_info_path
            ])
>           assert result.exit_code == 0
E           AssertionError: assert 1 == 0
E            +  where 1 = <Result FileNotFoundError(2, 'No such file or directory')>.exit_code

For now we mark the test and skip for tox but it would be nice to resolve this

nsorros commented 2 years ago

This is fixed as part of #175