[Zope-dev] unit test policy questions

2010-07-29 Thread yuppie
Hi!


Traditionally the last two lines of unit test files look like this:

if __name__ == '__main__':
 unittest.main(defaultTest='test_suite')

That makes it easy to run the tests of a specific file. But it doesn't 
work with tests that require the zope testrunner. AFAICS something like 
this is needed instead:

if __name__ == '__main__':
 from zope.testing.testrunner import run
 run(['-m', 'test_foo', '--test-path', '.'])


Questions:
--

1.) Is it still policy to add these lines?

2.) Is there a better solution for using zope testrunner than the one 
shown above?


Cheers,

Yuppie
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Zope Tests: 36 OK, 13 Failed, 1 Unknown

2010-07-29 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list.
Period Wed Jul 28 12:00:00 2010 UTC to Thu Jul 29 12:00:00 2010 UTC.
There were 50 messages: 6 from Zope Tests, 1 from buildbot at 
enfoldsystems.com, 4 from buildbot at pov.lt, 13 from buildbot at 
winbot.zope.org, 11 from ccomb at free.fr, 15 from jdriessen at 
thehealthagency.com.


Test failures
-

Subject: FAILED : Bluebream / Python2.4.6 32bit linux
From: ccomb at free.fr
Date: Wed Jul 28 22:06:01 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017477.html

Subject: FAILED : Bluebream / Python2.5.2 32bit linux
From: ccomb at free.fr
Date: Wed Jul 28 22:06:10 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017478.html

Subject: FAILED : Bluebream / Python2.6.4 32bit linux
From: ccomb at free.fr
Date: Wed Jul 28 22:06:13 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017479.html

Subject: FAILED : winbot / ztk_dev py_244_win32
From: buildbot at winbot.zope.org
Date: Wed Jul 28 22:08:13 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017480.html

Subject: FAILED : winbot / ztk_dev py_254_win32
From: buildbot at winbot.zope.org
Date: Wed Jul 28 22:15:10 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017482.html

Subject: FAILED : winbot / ztk_dev py_265_win32
From: buildbot at winbot.zope.org
Date: Wed Jul 28 22:22:30 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017483.html

Subject: FAILED : winbot / ztk_dev py_265_win64
From: buildbot at winbot.zope.org
Date: Wed Jul 28 22:29:09 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017484.html

Subject: FAILED : winbot / ztk_10 py_244_win32
From: buildbot at winbot.zope.org
Date: Wed Jul 28 22:37:23 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017486.html

Subject: FAILED : ZTK 1.0dev / Python2.4.6 Linux 32bit
From: ccomb at free.fr
Date: Wed Jul 28 23:45:34 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017490.html

Subject: FAILED : ZTK 1.0dev / Python2.6.4 Linux 32bit
From: ccomb at free.fr
Date: Wed Jul 28 23:47:52 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017491.html

Subject: FAILED : ZTK 1.0dev / Python2.5.2 Linux 32bit
From: ccomb at free.fr
Date: Wed Jul 28 23:48:09 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017492.html

Subject: FAILED : winbot / ZODB_dev py_270_win32
From: buildbot at winbot.zope.org
Date: Thu Jul 29 03:12:38 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017502.html

Subject: FAILED : winbot / ZODB_dev py_270_win64
From: buildbot at winbot.zope.org
Date: Thu Jul 29 04:08:06 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017503.html


Unknown
---

Subject: [zodb-tests] buildbot failure in Enfold Systems on 
zodb-trunk-python-2.6-maestro
From: buildbot at enfoldsystems.com
Date: Thu Jul 29 03:04:54 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017501.html


Tests passed OK
---

Subject: OK : Zope 3.4 Known Good Set / py2.4-64bit-linux
From: buildbot at pov.lt
Date: Wed Jul 28 21:09:00 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017469.html

Subject: OK : Zope 3.4 Known Good Set / py2.4-32bit-linux
From: buildbot at pov.lt
Date: Wed Jul 28 21:29:19 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017470.html

Subject: OK : Zope-2.10 Python-2.4.6 : Linux
From: Zope Tests
Date: Wed Jul 28 21:37:22 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017471.html

Subject: OK : Zope-2.11 Python-2.4.6 : Linux
From: Zope Tests
Date: Wed Jul 28 21:39:23 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017472.html

Subject: OK : Zope-2.12 Python-2.6.5 : Linux
From: Zope Tests
Date: Wed Jul 28 21:41:23 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017473.html

Subject: OK : Zope-2.12-alltests Python-2.6.5 : Linux
From: Zope Tests
Date: Wed Jul 28 21:43:23 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017474.html

Subject: OK : Zope-trunk Python-2.6.5 : Linux
From: Zope Tests
Date: Wed Jul 28 21:45:23 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017475.html

Subject: OK : Zope-trunk-alltests Python-2.6.5 : Linux
From: Zope Tests
Date: Wed Jul 28 21:47:24 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017476.html

Subject: OK : Zope 3.4 Known Good Set / py2.5-64bit-linux
From: buildbot at pov.lt
Date: Wed Jul 28 22:09:21 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017481.html

Subject: OK : Zope 3.4 Known Good Set / py2.5-32bit-linux
From: buildbot at pov.lt
Date: Wed Jul 28 22:29:14 EDT 2010
URL: http://mail.zope.org/pipermail/zope-tests/2010-July/017485.html

Subject: OK : winbot / ztk_10 py_254_win32
From: buildbot at winbot.zope.org
Date: Wed Jul 28 22:45:03 EDT 2010
URL: 

Re: [Zope-dev] unit test policy questions

2010-07-29 Thread Martin Aspeli
On 29 July 2010 19:26, yuppie y.2...@wcm-solutions.de wrote:
 Hi!


 Traditionally the last two lines of unit test files look like this:

 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')

 That makes it easy to run the tests of a specific file. But it doesn't
 work with tests that require the zope testrunner. AFAICS something like
 this is needed instead:

 if __name__ == '__main__':
     from zope.testing.testrunner import run
     run(['-m', 'test_foo', '--test-path', '.'])


 Questions:
 --

 1.) Is it still policy to add these lines?

 2.) Is there a better solution for using zope testrunner than the one
 shown above?

I never do either. I install zc.recipe.testrunner in a buildout and
use bin/test, which picks up tests in modules automatically.

Martin
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread yuppie
Martin Aspeli wrote:
 I never do either. I install zc.recipe.testrunner in a buildout and
 use bin/test, which picks up tests in modules automatically.

Sure. But do you always run all tests it picks up while working on a 
specific test file? Or do you use bin/test with options that allow to 
run specific files?

Cheers, Yuppie
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread Martin Aspeli
On 29 July 2010 20:14, yuppie y.2...@wcm-solutions.de wrote:
 Martin Aspeli wrote:
 I never do either. I install zc.recipe.testrunner in a buildout and
 use bin/test, which picks up tests in modules automatically.

 Sure. But do you always run all tests it picks up while working on a
 specific test file? Or do you use bin/test with options that allow to
 run specific files?

See the -s and -t options. :)

Martin
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread yuppie
Hi Martin!


Martin Aspeli wrote:
 On 29 July 2010 20:14, yuppiey.2...@wcm-solutions.de  wrote:
 Martin Aspeli wrote:
 I never do either. I install zc.recipe.testrunner in a buildout and
 use bin/test, which picks up tests in modules automatically.

 Sure. But do you always run all tests it picks up while working on a
 specific test file? Or do you use bin/test with options that allow to
 run specific files?

 See the -s and -t options. :)

Well. It's not that simple. Today I tried to modify 
Products.GenericSetup.tests.test_tool using CMF.buildout/trunk.

I usually use the -m option, but that doesn't work in CMF.buildout 
because it already uses that option.

So I tried to execute the module and noticed that's currently broken.

The -s option doesn't allow to run a specific module.

And if I use the -t option (-ttest_tool), most tests fail :(


Cheers,

Yuppie
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread Christian Theune
On 07/29/2010 02:17 PM, Jens Vagelpohl wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 7/29/10 14:00 , Martin Aspeli wrote:
 On 29 July 2010 19:26, yuppiey.2...@wcm-solutions.de  wrote:
 1.) Is it still policy to add these lines?

 2.) Is there a better solution for using zope testrunner than the one
 shown above?

 I never do either. I install zc.recipe.testrunner in a buildout and
 use bin/test, which picks up tests in modules automatically.

 Same here. I have never in my life run tests by executing the module.
 The options provided by the testrunner to pare down what I want to test
 have always been sufficient for me.

 I have had a tendency to add these blurbs myself, thinking I guess it's
 useful for *someone*. But IMHO it's like those CVS/SVN $Id$ snippets,
 it's not really useful anymore.

Fullack.

Even better: the current test runner even lets you avoid the test_suite 
function in many cases.


-- 
Christian Theune · c...@gocept.com
gocept gmbh  co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1
Zope and Plone consulting and development

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread Jens Vagelpohl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 7/29/10 15:57 , yuppie wrote:
 Hanno Schlichting wrote:
 On Thu, Jul 29, 2010 at 2:23 PM, Martin Aspelioptilude+li...@gmail.com  
 wrote:
 On 29 July 2010 20:14, yuppiey.2...@wcm-solutions.de  wrote:
 Sure. But do you always run all tests it picks up while working on a
 specific test file? Or do you use bin/test with options that allow to
 run specific files?
 See the -s and -t options. :)
 Don't forget -m which runs exactly one module (file).

 I always use commands like:

 bin/test -s zope.package
 bin/test -s zope.package -m test_module
 bin/test -s zope.package -m test_module -t test_some_method
 
 If everybody is using this, nobody is using CMF.buildout for 
 development.

Huh? I use it. I just don't use -m myself.

jens

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkxRibYACgkQRAx5nvEhZLIE7wCfePls1EWIlJ5JlXmkk36kw1+y
ZJIAoLpNA7ukrhN/bOV5ZfiCf+GhUbXY
=h567
-END PGP SIGNATURE-
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread Hanno Schlichting
On Thu, Jul 29, 2010 at 3:57 PM, yuppie y.2...@wcm-solutions.de wrote:
 If everybody is using this, nobody is using CMF.buildout for
 development. Anyway. I fixed CMF.buildout:
 http://svn.zope.org/?rev=115204view=rev

I'm using CMF.buildout and was always annoyed by it overriding the -m
option. But the CMF tests are fast enough, so I just ran the tests for
a package at a time.

 Do you think it should become policy to remove def test_suite(): where
 possible? I'm not sure if I like that because it is less explicit.

I wouldn't make any decision at this point. Once we actually use
unittest2 inside zope.testing we might want to reevaluate this.

Hanno
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

yuppie wrote:
 Hi!
 
 
 Hanno Schlichting wrote:
 On Thu, Jul 29, 2010 at 2:23 PM, Martin Aspelioptilude+li...@gmail.com  
 wrote:
 On 29 July 2010 20:14, yuppiey.2...@wcm-solutions.de  wrote:
 Sure. But do you always run all tests it picks up while working on a
 specific test file? Or do you use bin/test with options that allow to
 run specific files?
 See the -s and -t options. :)
 Don't forget -m which runs exactly one module (file).

 I always use commands like:

 bin/test -s zope.package
 bin/test -s zope.package -m test_module
 bin/test -s zope.package -m test_module -t test_some_method
 
 If everybody is using this, nobody is using CMF.buildout for 
 development. Anyway. I fixed CMF.buildout:
 http://svn.zope.org/?rev=115204view=rev

+1 for removing the 'if __name__ == __main__' boilerplate
opportunistically.

 Especially since unittest and zope.testing can even discover
 TestSuites inside modules, it seems any kind of explicit configuration
 in the test files isn't needed anymore.
 
 Do you think it should become policy to remove def test_suite(): where 
 possible? I'm not sure if I like that because it is less explicit.

I don't believe that zope.testing's testrunner works without 'def
test_suite()'.


Tres.
- --
===
Tres Seaver  +1 540-429-0999  tsea...@palladion.com
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkxRkb0ACgkQ+gerLs4ltQ4KugCgtZa1XK2SRcMIeu4e0BlZZOQ4
t2gAnjPZjjPewRWr0OnxOeezDn0crgb5
=8VTG
-END PGP SIGNATURE-

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread Martin Aspeli
On 29 July 2010 22:35, Tres Seaver tsea...@palladion.com wrote:

 I don't believe that zope.testing's testrunner works without 'def
 test_suite()'.

Latter versions can detect unittest.TestCase-derived test suites
automatically. For doctests you still need test_suite().

Martin
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread Hanno Schlichting
On Thu, Jul 29, 2010 at 4:35 PM, Tres Seaver tsea...@palladion.com wrote:
 I don't believe that zope.testing's testrunner works without 'def
 test_suite()'.

Oh it does. Ever since 3.8.0 from mid 2009:

- Testrunner automatically picks up descendants of unittest.TestCase
in test modules, so you don't have to provide a test_suite() anymore.

This just doesn't work for doctests and various forms of auto
generating test cases and other fancier constructs.

Hanno
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] unit test policy questions

2010-07-29 Thread Marius Gedminas
On Thu, Jul 29, 2010 at 02:52:36PM +0200, yuppie wrote:
 Hi Martin!
 
 
 Martin Aspeli wrote:
  On 29 July 2010 20:14, yuppiey.2...@wcm-solutions.de  wrote:
  Martin Aspeli wrote:
  I never do either. I install zc.recipe.testrunner in a buildout and
  use bin/test, which picks up tests in modules automatically.
 
  Sure. But do you always run all tests it picks up while working on a
  specific test file? Or do you use bin/test with options that allow to
  run specific files?
 
  See the -s and -t options. :)
 
 Well. It's not that simple. Today I tried to modify 
 Products.GenericSetup.tests.test_tool using CMF.buildout/trunk.
 
 I usually use the -m option, but that doesn't work in CMF.buildout 
 because it already uses that option.

Ouch.  Not a good idea, in my book.

 So I tried to execute the module and noticed that's currently broken.
 
 The -s option doesn't allow to run a specific module.
 
 And if I use the -t option (-ttest_tool), most tests fail :(

That is an indication that the tests aren't independent.  I would
consider such a test suite to be broken.

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )