I was just working on this same sort of problem (first importer) a couple days ago and haven't gotten back to it, but it felt like I was close. You don't mention a conftest.py file which I think is important. The documentation on this topic is just OK but I can understand why. My next move is to integrate all of the information in this past mailing list discussion: How to use pytests for personal importers / ingest (google.com) [2]

Good luck!

On 2024-01-07 4:18 pm, Matt McCormick wrote:

I'm writing my first importer and trying to generate the test inputs following the instructions here https://beancount.github.io/docs/importing_external_data.html#regression-testing-your-importers

I believe I've followed the instructions but running `pytest` does not generate anything.

I have the following directory structure:

~/beancount/importers/fidelity

~/beancount/importers/fidelity has an __init__.py file with an Importer class that inherits from beancount.ingest.importer.ImporterProtocol

class Importer(ImporterProtocol):
... code

The Importer class implements all the required methods from ImporterProtocol. When I run `bean-extract` I get the output printed to the console.

I've added the test code listed in the document to __init__.py:

def test():
importer = Importer()
yield from regression.compare_sample_files(importer)

When I run pytest I get the following output:

=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.10.12, pytest-7.4.4, pluggy-1.3.0
rootdir: /home/matt/beancount/importers/fidelity
collected 0 items

============================================================================================== no tests ran in 0.00s ==============================================================================================

If I run `pytest` from the base beancount directory, it only runs the tests under my price sources module.

Can someone help identify what I may be missing?  Thank you

--
You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/cca05bf7-9b0a-4650-8e97-7154c0abb2cen%40googlegroups.com [1].


Links:
------
[1] https://groups.google.com/d/msgid/beancount/cca05bf7-9b0a-4650-8e97-7154c0abb2cen%40googlegroups.com?utm_medium=email&utm_source=footer
[2] https://groups.google.com/g/beancount/c/jH3vIKC7Zq4/m/bNSj-SEeCwAJ

--
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/102664e95bf45ea83374e3dc469d72c0%40axvig.com.

Reply via email to