citation-file-format / cffconvert

Command line program to validate and convert CITATION.cff files.
Apache License 2.0
95 stars 28 forks source link

Test test_local_cff_file_does_not_exist fails #388

Closed musicinmybrain closed 5 months ago

musicinmybrain commented 5 months ago
$ gh repo clone citation-file-format/cffconvert
$ cd cffconvert
$ python3.12 -m venv _e
$ . _e/bin/activate
(_e) $ pip install -e .[testing]
(_e) $ python -m pytest
[…]
tests/cli/cff_1_0_3/test_cli.py::test_local_cff_file_does_not_exist FAILED                                                                                                                            [  0%]

================================================================================================= FAILURES ==================================================================================================
____________________________________________________________________________________ test_local_cff_file_does_not_exist _____________________________________________________________________________________

    @pytest.mark.cli
    def test_local_cff_file_does_not_exist():
        runner = CliRunner()
        with runner.isolated_filesystem():
            result = runner.invoke(cffconvert, ["-f", "bibtex"])
>       assert isinstance(result.exception, FileNotFoundError)
E       AssertionError

tests/cli/cff_1_0_3/test_cli.py:18: AssertionError
========================================================================================== short test summary info ==========================================================================================
FAILED tests/cli/cff_1_0_3/test_cli.py::test_local_cff_file_does_not_exist - AssertionError
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================================== 1 failed, 3 passed in 3.46s ========================================================================================

It looks like the value of result.exception in this test is None.

musicinmybrain commented 5 months ago

Oh, I see, this works with the test path given explicitly as

python -m pytest test/

as recommended in

https://github.com/citation-file-format/cffconvert/blob/5295f87c0e261da61a7b919fc754e3a77edd98a7/README.dev.md?plain=1#L56

That’s a bit surprising, but easy enough.