Test programs assumptions
Martin Schulze
joey at infodrom.org
Thu Mar 18 20:32:18 CET 2004
Bernhard Herzog wrote:
> > Hmm, I seem to be unable to import test.support in order to import
> > SkipTest and stuff. There's no __init__.py in the test directory but
> > even creating it doesn't seem to help. Looks like I'm a bit lost
> > now.
>
> Have you added the test directory itself to sys.path, so that you can
> import support directly?
No, since I considered this ugly. However, adding the test directory
as well it seems to work.
Does this patch look like how the test should be run?
Regards,
Joey
Index: test_ogclib.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/wms/test/test_ogclib.py,v
retrieving revision 1.4
diff -u -r1.4 test_ogclib.py
--- test_ogclib.py 18 Mar 2004 17:13:28 -0000 1.4
+++ test_ogclib.py 18 Mar 2004 19:30:57 -0000
@@ -31,8 +31,11 @@
thubandir = os.path.abspath ("../../../")
else:
thubandir = os.path.abspath (os.path.dirname(__file__) + "/../../..")
+path.insert (0, thubandir + "/test")
path.insert (0, thubandir)
+import support
+
# ----------------------------------------------------------------------
# FIXME: Temporary code until PyOGCLib is a standard requirement
@@ -49,8 +52,7 @@
try:
from ogclib.WMSClient import WMSClient
except:
- print "No PyOGCLib found, hence no tests available."
- os._exit(-1)
+ raise support.SkipTest("No PyOGCLib found, hence no tests available.")
class TestOGCLib (unittest.TestCase, WMSClient):
@@ -214,7 +216,7 @@
if __name__ == "__main__":
- unittest.main()
+ support.run_tests()
"""
--
The MS-DOS filesystem is nice for removable media. -- H. Peter Anvin
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)