running unit tests for Zope 2.8
Hi -- I have a fix for http://www.zope.org/Collectors/Zope/2037 and would like to write a unit test for it. However, I don't seem to be able to run the existing unit tests for SiteAccess with zopectl test. I created a new instance, then in my instance run bin/zopectl test --dir=/opt/Zope-2.8/lib/python/Products/SiteAccess/tests/ which yields the following: Running tests via: /usr/local/bin/python /opt/Zope-2.8/bin/test.py -v --config-file /home/zope/zopefix/etc/zope.conf --libdir Products --dir=/opt/Zope-2.8/lib/python/Products/SiteAccess/tests/ Running unit tests at level 1 Running unit tests from /opt/Zope-2.8/lib/python/Products/SiteAccess/tests Parsing /home/zope/zopefix/etc/zope.conf ---------------------------------------------------------------------- Ran 0 tests in 0.000s Any idea as to why no tests run? Am I missing some special incantation to get zopectl test to run? Or should I be running the Zope tests some other way? Thanks Geoff
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Geoff Davis wrote:
Hi --
I have a fix for http://www.zope.org/Collectors/Zope/2037 and would like to write a unit test for it. However, I don't seem to be able to run the existing unit tests for SiteAccess with zopectl test.
I created a new instance, then in my instance run
bin/zopectl test --dir=/opt/Zope-2.8/lib/python/Products/SiteAccess/tests/
which yields the following:
Running tests via: /usr/local/bin/python /opt/Zope-2.8/bin/test.py -v --config-file /home/zope/zopefix/etc/zope.conf --libdir Products --dir=/opt/Zope-2.8/lib/python/Products/SiteAccess/tests/ Running unit tests at level 1 Running unit tests from /opt/Zope-2.8/lib/python/Products/SiteAccess/tests Parsing /home/zope/zopefix/etc/zope.conf
---------------------------------------------------------------------- Ran 0 tests in 0.000s
Any idea as to why no tests run? Am I missing some special incantation to get zopectl test to run? Or should I be running the Zope tests some other way?
The usual drill for testing code in the SOFTWARE_HOME is to run its test.py without the rest of that (no zopectl involved). In your case: $ cd /opt/Zope-2.8/ $ /usr/local/bin/python bin/test.py -v Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEFhTx+gerLs4ltQ4RAgw/AJ9fuNSW1TyDTPqUQIk8/PQBoln0ZwCfX6Mp N17oI9gUy7dshzn5Hnoo9Lo= =u/dE -----END PGP SIGNATURE-----
Hi Geoff, On Mon, 13 Mar 2006 18:04:14 -0500, Geoff Davis wrote:
bin/zopectl test --dir=/opt/Zope-2.8/lib/python/Products/SiteAccess/tests/
which yields the following:
Running tests via: /usr/local/bin/python /opt/Zope-2.8/bin/test.py -v --config-file /home/zope/zopefix/etc/zope.conf --libdir Products --dir=/opt/Zope-2.8/lib/python/Products/SiteAccess/tests/ Running unit tests at level 1 Running unit tests from /opt/Zope-2.8/lib/python/Products/SiteAccess/tests Parsing /home/zope/zopefix/etc/zope.conf
---------------------------------------------------------------------- Ran 0 tests in 0.000s
In my experience the --libdir must point to the *product* root and never to the test dir itself. It seems that the runner iterates through the test, ftest dirs under this root and in your case it finds none (since you are already inside it). So I would use bin/zopectl test --libdir=/opt/Zope-2.8/lib/python/Products/SiteAccess If I would want to run test from a specific file only, I would add the filename filter to the end like bin/zopectl test --libdir=/opt/Zope-2.8/lib/python/Products/SiteAccess \ Products/SiteAccess/tests/test_one.py and so on... -- Balazs Ree jabber + email: ree@ree.hu ICQ: 75955071 AIM + skype: reebalazs
Balazs, That almost did the trick. In the end I found that having both --libdir=/opt/Zope-2.8/lib/python/Products and --dir=/opt/Zope-2.8/lib/python/Products/SiteAccess/tests enabled the tests to run. Thanks! Geoff
participants (3)
-
Balazs Ree -
Geoff Davis -
Tres Seaver