redstreet / beancount_reds_importers

Simple ingesting tools for Beancount (plain text, double entry accounting software). More importantly, a framework to allow you to easily write your own importers.
GNU General Public License v3.0
104 stars 37 forks source link

Unit test generation is missing xlrd library #80

Closed farktronix closed 1 year ago

farktronix commented 1 year ago

When I run pytest --generate I get an error that xlrd isn't installed. Installing this manually with pip install xlrd fixes the problem but it would be great if that dependency were automatically installed.

Unfortunately I'm not savvy enough with Python to know how to fix this- I spent some time searching but I wasn't able to find a solution to this.


self = <uobbank_test.TestUOB object at 0x1030d7010>, importer = <beancount_reds_importers.importers.unitedoverseas.uobbank.Importer object at 0x1030d4f50>
file = <beancount.ingest.cache._FileMemo object at 0x1030d5dd0>

    def test_identify(self, importer, file):
        """Attempt to identify a file and expect results to be true.

        This method does not need to check against an existing expect file. It
        is just assumed it should return True if your test is setup well (the
        importer should always identify the test file).
        """
>       assert importer.identify(file)

../../.asdf/installs/python/3.11.4/lib/python3.11/site-packages/beancount/ingest/regression_pytest.py:123: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
beancount_reds_importers/libreader/reader.py:26: in identify
    self.initialize_reader(file)
beancount_reds_importers/libreader/xlsreader.py:22: in initialize_reader
    for r in rdr:
../../.asdf/installs/python/3.11.4/lib/python3.11/site-packages/petl/io/xls.py:43: in __iter__
    wb = xlutils_view.View(source3, **self.kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <petl.io.xlutils_view.View object at 0x103124c90>
file_contents = b'\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>\x00\x03\x00\xfe\xf...0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00(\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00'
class_ = None, kwargs = {'logfile': <_io.TextIOWrapper name='/dev/null' mode='w' encoding='UTF-8'>}

    def __init__(self, file_contents, class_=None, **kwargs):
        self.class_ = class_ or self.class_
>       from xlrd import open_workbook
E       ModuleNotFoundError: No module named 'xlrd'

../../.asdf/installs/python/3.11.4/lib/python3.11/site-packages/petl/io/xlutils_view.py:116: ModuleNotFoundError
redstreet commented 1 year ago

Good point, documented, thanks!

fix: https://github.com/redstreet/beancount_reds_importers/issues/80 document xlrd requirement
xlrd is optional, and thus not in requirements.txt, but is needed for
xls files and for testing