[Zconfig] SVN: ZConfig/trunk/ reduce (but not eliminate) incorrect test discovery under nose
Fred Drake
fdrake at gmail.com
Sat Feb 11 20:25:25 UTC 2012
Log message for revision 124378:
reduce (but not eliminate) incorrect test discovery under nose
Changed:
U ZConfig/trunk/NEWS.txt
U ZConfig/trunk/ZConfig/components/basic/tests/test_mapping.py
U ZConfig/trunk/ZConfig/components/logger/tests/test_logger.py
U ZConfig/trunk/ZConfig/tests/support.py
U ZConfig/trunk/ZConfig/tests/test_cfgimports.py
U ZConfig/trunk/ZConfig/tests/test_cmdline.py
U ZConfig/trunk/ZConfig/tests/test_cookbook.py
U ZConfig/trunk/ZConfig/tests/test_loader.py
U ZConfig/trunk/ZConfig/tests/test_schema.py
U ZConfig/trunk/buildout.cfg
-=-
Modified: ZConfig/trunk/NEWS.txt
===================================================================
--- ZConfig/trunk/NEWS.txt 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/NEWS.txt 2012-02-11 20:25:24 UTC (rev 124378)
@@ -3,6 +3,13 @@
==========================
+ZConfig 2.9.2 (unreleased)
+--------------------------
+
+- Adjust test classes to avoid base classes being considered separate
+ test cases by (at least) the "nose" test runner.
+
+
ZConfig 2.9.1 (2012-02-11)
--------------------------
Modified: ZConfig/trunk/ZConfig/components/basic/tests/test_mapping.py
===================================================================
--- ZConfig/trunk/ZConfig/components/basic/tests/test_mapping.py 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/ZConfig/components/basic/tests/test_mapping.py 2012-02-11 20:25:24 UTC (rev 124378)
@@ -15,11 +15,10 @@
"""Tests of the 'basic' section types provided as part of
ZConfig.components.basic."""
+import ZConfig.tests.support
import unittest
-from ZConfig.tests import support
-
SIMPLE_SCHEMA = '''\
<schema>
<import package="ZConfig.components.basic" file="mapping.xml" />
@@ -43,7 +42,9 @@
'''
-class BasicSectionTypeTestCase(support.TestBase):
+class BasicSectionTypeTestCase(
+ ZConfig.tests.support.TestHelper, unittest.TestCase):
+
schema = None
def setUp(self):
Modified: ZConfig/trunk/ZConfig/components/logger/tests/test_logger.py
===================================================================
--- ZConfig/trunk/ZConfig/components/logger/tests/test_logger.py 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/ZConfig/components/logger/tests/test_logger.py 2012-02-11 20:25:24 UTC (rev 124378)
@@ -41,8 +41,11 @@
return sio.getvalue() + "... Don't panic!"
-class LoggingTestBase(unittest.TestCase):
+class LoggingTestHelper:
+ # Not derived from unittest.TestCase; some test runners seem to
+ # think that means this class contains tests.
+
# XXX This tries to save and restore the state of logging around
# the test. Somewhat surgical; there may be a better way.
@@ -100,7 +103,7 @@
return conf
-class TestConfig(LoggingTestBase):
+class TestConfig(LoggingTestHelper, unittest.TestCase):
_schematext = """
<schema>
@@ -404,7 +407,7 @@
return logger
-class TestReopeningLogfilesBase(LoggingTestBase):
+class TestReopeningLogfilesHelper(LoggingTestHelper):
# These tests should not be run on Windows.
@@ -458,8 +461,9 @@
self.assert_("message 4" in text2)
self.assert_("message 5" in text3)
-class TestReopeningLogfiles(TestReopeningLogfilesBase):
+class TestReopeningLogfiles(TestReopeningLogfilesHelper, unittest.TestCase):
+
handler_factory = loghandler.FileHandler
_sampleconfig_template = """
@@ -555,7 +559,8 @@
self.assertEqual(calls, ["acquire", "release"])
-class TestReopeningRotatingLogfiles(TestReopeningLogfilesBase):
+class TestReopeningRotatingLogfiles(
+ TestReopeningLogfilesHelper, unittest.TestCase):
_sampleconfig_template = """
<logger>
Modified: ZConfig/trunk/ZConfig/tests/support.py
===================================================================
--- ZConfig/trunk/ZConfig/tests/support.py 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/ZConfig/tests/support.py 2012-02-11 20:25:24 UTC (rev 124378)
@@ -16,7 +16,6 @@
import os
import StringIO
-import unittest
import urllib
import ZConfig
@@ -35,9 +34,12 @@
CONFIG_BASE = "file://%s/" % urllib.pathname2url(d)
-class TestBase(unittest.TestCase):
+class TestHelper:
"""Utility methods which can be used with the schema support."""
+ # Not derived from unittest.TestCase; some test runners seem to
+ # think that means this class contains tests.
+
def load_both(self, schema_url, conf_url):
schema = self.load_schema(schema_url)
conf = self.load_config(schema, conf_url)
Modified: ZConfig/trunk/ZConfig/tests/test_cfgimports.py
===================================================================
--- ZConfig/trunk/ZConfig/tests/test_cfgimports.py 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/ZConfig/tests/test_cfgimports.py 2012-02-11 20:25:24 UTC (rev 124378)
@@ -24,7 +24,8 @@
import ZConfig.tests.support
-class TestImportFromConfiguration(ZConfig.tests.support.TestBase):
+class TestImportFromConfiguration(
+ ZConfig.tests.support.TestHelper, unittest.TestCase):
def test_simple_import(self):
schema = self.load_schema_text("<schema/>")
Modified: ZConfig/trunk/ZConfig/tests/test_cmdline.py
===================================================================
--- ZConfig/trunk/ZConfig/tests/test_cmdline.py 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/ZConfig/tests/test_cmdline.py 2012-02-11 20:25:24 UTC (rev 124378)
@@ -17,12 +17,12 @@
import unittest
import ZConfig
+import ZConfig.tests.support
from ZConfig.cmdline import ExtendedConfigLoader
-from ZConfig.tests.support import TestBase
-class CommandLineTest(TestBase):
+class CommandLineTest(ZConfig.tests.support.TestHelper, unittest.TestCase):
def create_config_loader(self, schema):
loader = ExtendedConfigLoader(schema)
Modified: ZConfig/trunk/ZConfig/tests/test_cookbook.py
===================================================================
--- ZConfig/trunk/ZConfig/tests/test_cookbook.py 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/ZConfig/tests/test_cookbook.py 2012-02-11 20:25:24 UTC (rev 124378)
@@ -20,11 +20,10 @@
"""
+import ZConfig.tests.support
import unittest
-from ZConfig.tests.support import TestBase
-
def basic_key_mapping_password_to_passwd(key):
# Lower-case the key since that's what basic-key does:
key = key.lower()
@@ -37,7 +36,7 @@
return section
-class CookbookTestCase(TestBase):
+class CookbookTestCase(ZConfig.tests.support.TestHelper, unittest.TestCase):
def test_rewriting_key_names(self):
schema = self.load_schema_text("""
Modified: ZConfig/trunk/ZConfig/tests/test_loader.py
===================================================================
--- ZConfig/trunk/ZConfig/tests/test_loader.py 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/ZConfig/tests/test_loader.py 2012-02-11 20:25:24 UTC (rev 124378)
@@ -25,7 +25,7 @@
import ZConfig.loader
import ZConfig.url
-from ZConfig.tests.support import CONFIG_BASE, TestBase
+from ZConfig.tests.support import CONFIG_BASE, TestHelper
try:
@@ -37,7 +37,7 @@
LIBRARY_DIR = os.path.join(os.path.dirname(myfile), "library")
-class LoaderTestCase(TestBase):
+class LoaderTestCase(TestHelper, unittest.TestCase):
def test_schema_caching(self):
loader = ZConfig.loader.SchemaLoader()
Modified: ZConfig/trunk/ZConfig/tests/test_schema.py
===================================================================
--- ZConfig/trunk/ZConfig/tests/test_schema.py 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/ZConfig/tests/test_schema.py 2012-02-11 20:25:24 UTC (rev 124378)
@@ -17,7 +17,7 @@
import ZConfig
-from ZConfig.tests.support import TestBase, CONFIG_BASE
+from ZConfig.tests.support import TestHelper, CONFIG_BASE
def uppercase(value):
@@ -40,7 +40,7 @@
return L
-class SchemaTestCase(TestBase):
+class SchemaTestCase(TestHelper, unittest.TestCase):
"""Tests of the basic schema support itself."""
def test_minimal_schema(self):
Modified: ZConfig/trunk/buildout.cfg
===================================================================
--- ZConfig/trunk/buildout.cfg 2012-02-11 06:18:27 UTC (rev 124377)
+++ ZConfig/trunk/buildout.cfg 2012-02-11 20:25:24 UTC (rev 124378)
@@ -1,8 +1,13 @@
[buildout]
develop = .
-parts = test
+parts = nosetests test
prefer-final = true
+[nosetests]
+recipe = zc.recipe.egg
+eggs = nose
+scripts = nosetests
+
[test]
recipe = zc.recipe.testrunner
eggs = ZConfig
More information about the ZConfig
mailing list