Re: [Tutor] unittest skipping tests

2013-08-01 Thread Alan Gauld

On 01/08/13 14:22, Matthew Ngaha wrote:

Thanks guys. i was following some examples and noticed it. I tried to
use it in my program and the same thing happened. In this example,
there are 6 tests, and only 4 run.

http://bpaste.net/show/abLNTHU49w1j2M8Fey8X/


You're still just teasing us.
You show us the code and say 4 methods run.
But which 4?

And how are you running the test?
And what output do you get that tells you 4 ran?

We need to know what is happening in more detail.
While you are at it, which OS and Python  version too.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] unittest skipping tests

2013-08-01 Thread Walter Prins
Hi,

On 1 August 2013 14:22, Matthew Ngaha  wrote:

> Thanks guys. i was following some examples and noticed it. I tried to
> use it in my program and the same thing happened. In this example,
> there are 6 tests, and only 4 run.
>
> http://bpaste.net/show/abLNTHU49w1j2M8Fey8X/
>

The reason that 2 of the tests are apparently ignored, is because they are
overwritten/redefined by the last 2 test methods in the class, which have
the same name as the prior 2.  You cannot have have multiple methods with
the same name in the same class.Change the name of the last 2 methods
in your class and your problem will go away.

Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] unittest skipping tests

2013-08-01 Thread Walter Prins
Hi,

On 1 August 2013 13:11, Matthew Ngaha  wrote:

> im trying to do some unittesting and i've written 1 class with 4 test
> methods and it skips 2 of these methods for no reason. If i comment
> out the 2 it doesn't skip, it will now test the 2 it previously
> skipped. Is this the default behaviour to only test 2 methods in a
> class?


No.  (That would be silly, nay, crazy even.)



> Anyone have any ideas how i can solve this problem?


Alan's answer is the first port of call.  You really need to give us more
to work with, otherwise we're just guessing, and if we have to guess it
makes our lives and your life more difficult than it needs to be.

That said, what you describe makes me suspect indentation problems of some
sort.  It sounds almost as if the latter test methods are somehow
considered to be inside the former test code, such that they're not "seen"
by the testing framework's test discovery process.  And, when you then
comment out the prior 2 methods, the latter 2 become "visible" due to not
being in the former's enclosing scope.  Or something like that.  But,
that's just a guess, and may be way off base...


Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] unittest skipping tests

2013-08-01 Thread Alan Gauld

On 01/08/13 13:11, Matthew Ngaha wrote:

im trying to do some unittesting and i've written 1 class with 4 test
methods and it skips 2 of these methods for no reason. If i comment
out the 2 it doesn't skip, it will now test the 2 it previously
skipped. Is this the default behaviour


I'm pretty sure its not the default but it might help if you posted the 
code and a cut n' paste of your test session. That way we can see what 
framework you use, how you use it and what actually happens.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor