~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/config/tests/test_config.py

Changes per review. this includes a mass renaming, rewriting, and deletiong of conf files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
schema_file = os.path.join(here, 'schema.xml')
23
23
schema = ZConfig.loadSchema(schema_file)
24
24
 
25
 
top_directory = os.path.join(here, '../../..', 'configs')
26
 
lazr_schema_file = os.path.join(top_directory, 'schema.lazr.conf')
 
25
lazr_schema_file = os.path.join(here, 'schema-lazr.conf')
27
26
 
28
27
# This is necessary because pid_dir typically points to a directory that only
29
28
# exists on the deployed servers, almost never on a developer machine.
41
40
    """Return a class to test a single lazr.config file.
42
41
 
43
42
    The config file name is shown in the output of test.py -vv. eg.
44
 
    testConfig (canonical.config.tests.test_config...configs/schema.lazr.conf)
 
43
    (canonical.config.tests.test_config.../configs/schema.lazr.conf)
45
44
    """
46
45
    class LAZRConfigTestCase(unittest.TestCase):
47
46
        """Test a lazr.config."""
58
57
                message = '\n'.join([str(e) for e in error.errors])
59
58
                self.fail(message)
60
59
    # Hack the config file name into the class name.
61
 
    LAZRConfigTestCase.__name__ = '..configs/' + description
 
60
    LAZRConfigTestCase.__name__ = '../configs/' + description
62
61
    return LAZRConfigTestCase
63
62
 
64
63
 
72
71
        optionflags=NORMALIZE_WHITESPACE | ELLIPSIS
73
72
        ))
74
73
    # Add a test for every launchpad[.lazr].conf file in our tree.
 
74
    top_directory = os.path.join(here, '../../..', 'configs')
75
75
    prefix_len = len(top_directory) + 1
76
 
    lazr_conf_files = ('launchpad.default.conf', 'launchpad.testrunner.conf')
77
76
    for dirpath, dirnames, filenames in os.walk(top_directory):
78
77
        for filename in filenames:
79
78
            if filename == 'launchpad.conf':
85
84
                # doesn't do what we want.
86
85
                suite.addTest(unittest.FunctionTestCase(
87
86
                    make_test(config_file, 'configs/' + description)))
88
 
            elif filename in lazr_conf_files:
 
87
            elif filename == 'launchpad-lazr.conf':
89
88
                # Test the lazr.config conf files.
90
89
                config_file = os.path.join(dirpath, filename)
91
90
                description = config_file[prefix_len:]