Fix generic importer tests that implicitly depend on libmagic #74
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The generic importer source takes a directory, looks at all files in
that directory recursively, and then filters down to the files that are
of the right type for its importer. The tests for it point it to a
directory that contains not only the test source CSV file, but also the
test verification beancount and JSON files.
I haven't verified, but I'm guessing this worked for the original author
because they had
python-magic
andlibmagic
installed. But withoutthose installed, beancount's file-identification fails (ironically) on
the
.beancount
files, causing these tests to fail.Since
libmagic
is supposed to be an optional dependency of beancount,and it can't be listed as an automatic test dependency (since it's not a
Python library), the tests should not require it in order to pass.
This behavior of the generic importer (silently excluding files of a
type it doesn't know how to handle) seems a bit too magical and implicit
for my tastes, but since I didn't author and don't use this importer I'm
not changing its behavior. Instead I just rearranged the test data
directory so the source CSV file is in its own subdirectory, eliminating
the problem of making the importer identify the various other test
support files.
With this PR all tests are green again, even without
libmagic
installed.