Hi Martin, Sure. If you look under the beancount.plugins package, there are many many examples.
You write your plugin in a library file, and unit tests in the other. For example, if your plugin is called "andersen", you would create these files next to each other: - andersen.py - ansersen_test.py somewhere on your PYTHONPATH. Then you would run nosetests on the test files to run all the unittests (from package python-nose, or just nose). There are a lot of utility functions to automatically create input files from docstrings. e.g. the beancount.loader.load_doc() decorator. See the plugins directory, many of the tricks are used there. Writing unit tests is the best way to debug things, because - the inputs can be made minimal and specific to the particular code branch of feature you're testing - they remain through the lifetime of the plugin, so you can just rerun them as the upstream Beancount code evolves - you can easily run all of them at the same time - they serve as documentation for your expectations of what the plugin does. - they prevent regressions, as you evolve your plugin itself I hope this helps, On Thu, Jan 12, 2017 at 5:27 AM, <[email protected]> wrote: > So I'm attempting to write a plugin, but i'm at a loss as to how I debug > it - even as far as just knowing the plugin is loaded. I've peeked around > at the source code of other plugins, and the docs, but apparently my eyes > are getting in the way of my vision. Any pointers? > > -- > 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 post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/beancount/89acc7a9-7142-4842-b39b-95165bb0d434%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/89acc7a9-7142-4842-b39b-95165bb0d434%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhPgD6wVH5vPhdMyPM%2BNzgiT8DeFq50Xz8e%3Dup%2BbgcG%3Dzg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
