![]() ![]() |
||
![]() |
![]() |
|
![]() |
AW: [wingide-users] unittest: Any experiences of unit testing under WingIDEF. GEIGER fgeiger@datec.atTue, 25 Sep 2001 17:57:32 +0200
> import unittest
> unittest.main('mytestclasses')
>
> or:
>
> import unittest
> import mytestclasses
> unittest.main(mytestclasses)
That did the trick, thanks!
Best regards
Franz
> -----Ursprungliche Nachricht-----
> Von: wingide-users-admin@archaeopteryx.com
> [mailto:wingide-users-admin@archaeopteryx.com]Im Auftrag von Stephan
> R.A. Deibel
> Gesendet: Dienstag, 25. September 2001 16:49
> An: F. GEIGER
> Cc: Wingide-Users@Archaeopteryx. Com
> Betreff: Re: [wingide-users] unittest: Any experiences of unit testing
> under WingIDE
>
>
> Hi,
>
> On Tue, 25 Sep 2001, F. GEIGER wrote:
> > I wanted to play around with unittest. I wanted to do that
> within WingIDE of
> > course but had to see, that the test cases are not executed in
> this case:
> > "Ran 0 tests in 0.000s". If I run the script of question from
> the console it
> > tells me "Ran 1 test in...". So what's the difference? Can I configure
> > WingIDE somehow to "cooperate" with unittest?
>
> The problem is that __main__ is not really the same when you run within
> the Wing debugger, because the wrapper call wingdb.py is __main__. We try
> to hide this from the debug process but you've uncovered a bug in Wing
> 1.1b7-2 and earlier where our import hook is not returning the faked
> __main__ upon __import__('__main__') (which is what unittest.py is doing).
>
> There are two ways to work around this for now:
>
> 1) Write a small substitute main entry point for your test instead of
> using the "if __name__ == '__main__'" clause. So in a seperate file
> you would have:
>
> import unittest
> unittest.main('mytestclasses')
>
> or:
>
> import unittest
> import mytestclasses
> unittest.main(mytestclasses)
>
> In this case you are explicitely giving the test modules so you
> don't run into the __main__ problem.
>
> 2) Use wingdbstub and launch the process from the command line.
> In this case __main__ is correct because there is no difference
> in what you're launching from the non-debug case.
>
> The __import__('__main__') bug should be fixed in the next release.
>
> Thanks for reporting this!
>
> - Stephan
>
> _________________________________________________
> Archaeopteryx Software, Inc.
> Wing IDE discussion list
> http://archaeopteryx.com/support/forum
>
Run by Mailman v 2.0.8 |
|
|
Copyright (c) 2000-2002, Archaeopteryx Software, Inc. Legal Statements | ||