a tip I've found useful; the default is stubs which fail, but the 'nose' type stubs succeed by default.
$ pythoscope -t nose leo/core/leoGlobals.py will result in the file tests/test_leo_core_leoGlobals.py which, when run $ python tests/test_leo_core_leoGlobals.py will be silent. If the `-t nose` option is not used, every test issues a failure notice. On Wed, Dec 3, 2008 at 2:47 PM, MichaĆ Kwiatkowski <[EMAIL PROTECTED]> wrote: > > 2008/12/2 Edward K. Ream <[EMAIL PROTECTED]>: >> 1. I wasn't sure which directory should be used when using pythoscope >> --init. I guessed it should be Leo's trunk directory so I could do >> 'pythoscope leo'. That is, I thought it would be useful to do the >> entire leo package. And yes, the leo directory *is* a package. > > Yes, your project top directory is the right one to use. > >> 2. However, 'pythoscope leo' started analyzing lots of files, so I hit >> ctrl-c and got a traceback saying to report a bug. I'm pretty sure >> that's not necessary :-) >> >> 3. In an effort to reduce the amount of work that pythoscope was doing >> (I was in a hurry just to see what kind of output pythoscope was going >> to create), I specified the leo/core package. But still, pythoscope >> started analyzing packages outside the leo/core package, so again I >> hit ctrl-c. > > Analyze step is implicit in Pythoscope. What you specify as arguments > to pythoscope command is modules you want to generate tests for. > > Still, if all you want is to generate test stubs, I admit, there is no > good reason for Pythoscope to analyze everything. Since this is a real > pain for bigger projects and I've heard this complain before, I will > probably fix this sooner than later. > > Having said that, dynamic analysis puts more requirements on what we > have to analyze statically. The reason why Pythoscope currently > inspects everything can be summarized in the following two points: > > * you can't run any dynamic analysis without prior static knowledge > about the system, like location and contents of modules > * understanding dependencies between modules is a hard problem, one > which we currently avoid by analyzing everything > > There is a plan to make Pythoscope faster, see > http://pythoscope.org/improving-performance for some rough overview. I > think some of those optimizations may actually be fun to implement, so > if anyone has some free time on their hands, I'll be happy to accept > patches. ;-) > >> 4. The tutorial said I could point pythoscope at a single file, so I did:: >> >> pythoscope leo/core/leoNodes.py >> >> This still analyzes a lot, but ok, I let it run. > > Yeah, see above. And thanks for patience. :-) > >> Now I got a real bug: >> >> QQQQQQ >> pythoscope leo/core/leoNodes.py >> INFO: Inspecting module launchLeo.py. >> INFO: Inspecting module leo\core\komodo-test-data.py. > [cut lots of inspects] >> INFO: Inspecting module leo\modes\latex.py. >> ERROR: Oops, it seems internal Pythoscope error occured. Please file a >> bug report at https://bugs.launchpad.net/pythoscope >> >> Traceback (most recent call last): >> File "c:\Python25\Scripts\pythoscope-script.py", line 8, in <module> >> load_entry_point('pythoscope==0.3.2', 'console_scripts', 'pythoscope')() >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\pythoscope\__init__.py", >> line 176, in main >> generate_tests(args, force, template) >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\pythoscope\__init__.py", >> line 104, in generate_tests >> inspect_project(project) >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\pythoscope\inspector\__init__.py", >> line 11, in inspect_project >> updates = add_and_update_modules(project) + >> add_and_update_points_of_entry(project) >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\pythoscope\inspector\__init__.py", >> line 36, in add_and_update_modules >> static.inspect_module(project, modpath) >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\pythoscope\inspector\static.py", >> line 119, in inspect_module >> return inspect_code(project, path, read_file_contents(path)) >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\pythoscope\inspector\static.py", >> line 126, in inspect_code >> visitor = descend(tree, ModuleVisitor) >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\pythoscope\astvisitor.py", >> line 58, in descend >> visitor.visit(tree) >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\pythoscope\astvisitor.py", >> line 234, in visit >> self.visit_node(tree) >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\pythoscope\astvisitor.py", >> line 247, in visit_node >> if pattern.match(node, results): >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\lib2to3\pytree.py", >> line 428, in match >> if not self._submatch(node, r): >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\lib2to3\pytree.py", >> line 542, in _submatch >> for c, r in generate_matches(self.content, node.children): >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\lib2to3\pytree.py", >> line 744, in generate_matches >> for c0, r0 in p.generate_matches(nodes): >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\lib2to3\pytree.py", >> line 658, in generate_matches >> for count, r in self._recursive_matches(nodes, 0): >> >> [big snip] >> >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\lib2to3\pytree.py", >> line 686, in _recursive_matches >> for c0, r0 in generate_matches(alt, nodes): >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\lib2to3\pytree.py", >> line 744, in generate_matches >> for c0, r0 in p.generate_matches(nodes): >> File >> "c:\python25\lib\site-packages\pythoscope-0.3.2-py2.5.egg\lib2to3\pytree.py", >> line 451, in generate_matches >> if nodes and self.match(nodes[0], r): >> RuntimeError: maximum recursion depth exceeded >> >> C:\leo.repo\trunk> >> QQQQQQ >> >> So I'm stuck. What should I do next? > > That seems like a bug. Let's track that here: > > https://bugs.launchpad.net/pythoscope/+bug/304541 > > In the meantime, if you just want to play with Pythoscope to see what > it can do, you may choose a smaller project for testing. Even a simple > script will do. You can also read the tutorial: > http://pythoscope.org/documentation , but you have probably done that > already. > > Cheers, > mk > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
