[MERGE][0.14] Skip tests when 'tools' is not available

Alexander Belchenko bialix at ukr.net
Thu Jan 18 16:16:26 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel пишет:
> We do not install the 'tools' package that exists in the source
> distribution. Recently Alexander added a couple of tests for it (which
> is good), but they fail in an installed copy because the package is not
> available (bad thing).

I apologize for this. And because it's my fault I'd like to help
to fix it.

> 
> This patch just skips them if it cannot find the 'tools' packages.
> 
> Arguably, it should know more about whether it is in source or not,
> (potentially these tests could start skipping and we wouldn't realize
> they weren't running).
> 
> I'm still happy enough with it to ask for it to be merged.

Can we assume that selftest is launched from inside bzr.dev
sources, so directore where bzr script is located should be presence
of bzrlib and tools packages? If we can permit this assumption
we can create test class in test_generate_docs.py conditionally.

Or we can allow to run this test *only* from bzr.dev repository,
i.e. by check presence of valid bzr.dev branch?

I.e. when running on installed copy we just check if in directory with
bzr presents both bzrlib and tools packages, this check fails and we
fall to create test class itself. I'd like to check not only presence
of tools package because this name is too general.

What you think?

Alexander

- ------------------------------------------------------------------------

# Bazaar revision bundle v0.8
#
# message:
#   Allow tests to skip after installation, since certain packages will not be available.
# committer: иЌиЇй�й� иЙиБиЈиЇиД й�иЇй�й�й� <juju at arbash-meinel.com>
# date: Thu 2007-01-18 08:49:08.671000004 -0600

=== modified file bzrlib/tests/test_generate_docs.py
- --- bzrlib/tests/test_generate_docs.py
+++ bzrlib/tests/test_generate_docs.py
@@ -22,7 +22,7 @@

 from cStringIO import StringIO

- -from bzrlib.tests import TestCase
+from bzrlib.tests import TestCase, TestSkipped


 class Options:
@@ -38,13 +38,19 @@
         self.options.bzr_name = 'bzr'

     def test_man_page(self):
- -        from tools.doc_generate import autodoc_man
+        try:
+            from tools.doc_generate import autodoc_man
+        except ImportError:
+            raise TestSkipped('The package "tools" is not available to test.')

         autodoc_man.infogen(self.options, self.sio)
         self.assertNotEqual('', self.sio.getvalue())

     def test_rstx_man(self):
- -        from tools.doc_generate import autodoc_rstx
+        try:
+            from tools.doc_generate import autodoc_rstx
+        except ImportError:
+            raise TestSkipped('The package "tools" is not available to test.')

         autodoc_rstx.infogen(self.options, self.sio)
         self.assertNotEqual('', self.sio.getvalue())

=== modified directory  // last-changed:juju at arbash-meinel.com-20070118144908-8
.... 72rgajafdmzjpm7
# revision id: juju at arbash-meinel.com-20070118144908-872rgajafdmzjpm7
# sha1: 3b5715db95190854308e4d84badb3c3aeb34b9d8
# inventory sha1: e8af584c287aedddfd0b101cb0ebffcea36db788
# parent ids:
#   john at arbash-meinel.com-20070111155741-ytnaog8q1mwz71u6
# base id: john at arbash-meinel.com-20070111155741-ytnaog8q1mwz71u6
# properties:
#   branch-nick: jam-integration


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFr51azYr338mxwCURArznAJ9jeS4EMBjpXHgxoMWDk7+pBeca4wCeKWsz
BLEnr59YnqvH4PcEnLS/1G0=
=GWf4
-----END PGP SIGNATURE-----




More information about the bazaar mailing list