A few questions and suggestions

18 views
Skip to first unread message

dmb

unread,
Aug 20, 2010, 10:00:50 AM8/20/10
to Pythoscope
I'm just getting started with Pythoscope; it looks very impressive.
One question I have -- and I'm sorry if this is a FAQ, but I couldn't
find the answer anywhere: is there are way to tell Pythoscope *not* to
emit tests for a particular function or method? When I put a call in
my points of entry, it generates tests for not only the function I
call there, but all the functions called in turn as well. I can see
why this is incredibly useful, but in some cases I would like to turn
that recursive behavior off.

One comment: it would be nice to be able to move the points-of-entry
directory out of .pythoscope. This would make it straightforward to
check the points-of-entry directory into, say svn, while leaving out
the rest of .pythoscope. It seems like most of .pythoscope is
temporary, generated files, while the points-of-entry files and the
generated tests in tests/ are things you want to version control.

Dave

Michał Kwiatkowski

unread,
Aug 20, 2010, 11:42:22 AM8/20/10
to pytho...@googlegroups.com
On Fri, Aug 20, 2010 at 4:00 PM, dmb <dmba...@gmail.com> wrote:
> I'm just getting started with Pythoscope; it looks very impressive.
> One question I have -- and I'm sorry if this is a FAQ, but I couldn't
> find the answer anywhere: is there are way to tell Pythoscope *not* to
> emit tests for a particular function or method? When I put a call in
> my points of entry, it generates tests for not only the function I
> call there, but all the functions called in turn as well. I can see
> why this is incredibly useful, but in some cases I would like to turn
> that recursive behavior off.

Unfortunately there isn't anything like that. Right now you can only
select modules you want tests generated for. You can't select a
particular function nor you can exclude one, although it is a feature
requested before, see
https://blueprints.launchpad.net/pythoscope/+spec/locators-for-testable-objects
I might have some time to fix that soon, but I can't promise anything.
I would gladly accept a patch though. ;-)

> One comment: it would be nice to be able to move the points-of-entry
> directory out of .pythoscope. This would make it straightforward to
> check the points-of-entry directory into, say svn, while leaving out
> the rest of .pythoscope. It seems like most of .pythoscope is
> temporary, generated files, while the points-of-entry files and the
> generated tests in tests/ are things you want to version control.

You're right, only .points-of-entry have to be versioned, although I
can imagine bigger projects checking in the whole .pythoscope. Anyway,
I agree that it should be easier to manage points of entry via a VCS
and I'm willing to make this change, unless someone has an objection.
Anyone?

Cheers,
mk

Michał Kwiatkowski

unread,
Aug 20, 2010, 2:42:01 PM8/20/10
to pytho...@googlegroups.com
2010/8/20 Michał Kwiatkowski <consta...@gmail.com>:

> On Fri, Aug 20, 2010 at 4:00 PM, dmb <dmba...@gmail.com> wrote:
>> I'm just getting started with Pythoscope; it looks very impressive.
>> One question I have -- and I'm sorry if this is a FAQ, but I couldn't
>> find the answer anywhere: is there are way to tell Pythoscope *not* to
>> emit tests for a particular function or method? When I put a call in
>> my points of entry, it generates tests for not only the function I
>> call there, but all the functions called in turn as well. I can see
>> why this is incredibly useful, but in some cases I would like to turn
>> that recursive behavior off.
>
> Unfortunately there isn't anything like that. Right now you can only
> select modules you want tests generated for. You can't select a
> particular function nor you can exclude one, although it is a feature
> requested before, see
> https://blueprints.launchpad.net/pythoscope/+spec/locators-for-testable-objects
> I might have some time to fix that soon, but I can't promise anything.
> I would gladly accept a patch though. ;-)

OK, I wanted to give you something, so I hacked up a quick version
that just might be enough.

Get the code by doing:

$ bzr branch lp:~ruby/pythoscope/locators

and install as usual.

Now let's say you have a file called foo.py with "bar" and "baz"
functions in it. You can generate tests only for function "bar" by
doing:

$ pythoscope foo.py:bar

It should work for functions and classes, not for methods though. Hope
that helps. Feel free to improve the code if you need the exclude
option. At this point it should be pretty straightforward to add.

Cheers,
mk

dmb

unread,
Aug 20, 2010, 3:26:14 PM8/20/10
to Pythoscope
Hi Michał,

I'm happy to try to add that feature. Where would you suggest adding
it? And what should the mechanism used be -- a comment in source? A
decorator? Etc.

Dave

On Aug 20, 11:42 am, Michał Kwiatkowski <constant.b...@gmail.com>
wrote:
> Unfortunately there isn't anything like that. Right now you can only
> select modules you want tests generated for. You can't select a
> particular function nor you can exclude one, although it is a feature
> requested before, seehttps://blueprints.launchpad.net/pythoscope/+spec/locators-for-testab...

dmb

unread,
Aug 20, 2010, 3:26:57 PM8/20/10
to Pythoscope
Cool! I will try it.

Dave

On Aug 20, 2:42 pm, Michał Kwiatkowski <constant.b...@gmail.com>
wrote:

Kent Tenney

unread,
Aug 23, 2010, 9:16:46 AM8/23/10
to pytho...@googlegroups.com
2010/8/20 Michał Kwiatkowski <consta...@gmail.com>:

+1 on being able to relocate .points-of-entry/ to a versioned location, a
very desirable feature from my point of view.

Thanks,
Kent

>
> Cheers,
> mk
>
> --
> You received this message because you are subscribed to the Google Groups "Pythoscope" group.
> To post to this group, send email to pytho...@googlegroups.com.
> To unsubscribe from this group, send email to pythoscope+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pythoscope?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages