On Sat, Mar 6, 2010 at 5:10 PM, Terry Brown <[email protected]> wrote: > So I have a module which *is* a Leo plugin, although I'm also interested in > the case where the module isn't related to Leo. > > So, I have a top level function in the module, I think they question would be > the same if it was a class. How do I refer to that function / class from a > @test node? > > Do I have to import it?
Yes. > Am I doing this all wrong? Not really. You have several choices for running unit tests. My present favorite is to run unit tests externally with Alt-6. You can make it easier to import your module by adding the desired path to sys.path in sitecustomize.py. But the way you have chosen isn't horrible either. Another way is to run tests from something like unitTest.leo. Depending on where the .leo file is, you may be able to import the module under test directly. The drawback is that you have to reload unitTest.leo when your code changes. As I said, I prefer the Alt-6 way because I can test code instantly after it changes. This is such a good deal that a little hacking of sys.path isn't odious. The unit test serves as a framework for development, so a minute or two getting the imports right doesn't make any difference. HTH. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.
