} def _replicate_hg_test(test_class, *variants): if not variants: variants = ("Flatmanifest", "Treemanifest") for name in variants: config_fn = ALL_CONFIGS[name] class HgTestVariant(test_class): config_variant_name = name apply_hg_config_variant = config_fn yield name, HgTestVariant # A decorator function used to define test cases that test eden+mercurial. # # This decorator creates multiple TestCase subclasses from a single input # class. This allows us to re-run the same test code with several different # mercurial extension configurations. # # The test case subclasses will have different suffixes to identify their # configuration. Currently for a given input test class named "MyTest", # this will create subclasses named: # - "MyTestFlat": configures hg using the vanilla flat manifest # - "MyTestTree": configures hg using treemanifest # - "MyTestTreeOnly": configures hg using treemanifest.treeonly hg_test = testcase.test_replicator(_replicate_hg_test)
ALL_CONFIGS = {"TreeOnly": _apply_treeonly_config} def _replicate_hg_test(test_class, *variants): if not variants: variants = ("TreeOnly", ) for name in variants: config_fn = ALL_CONFIGS[name] class HgTestVariant(test_class): config_variant_name = name apply_hg_config_variant = config_fn yield name, HgTestVariant # A decorator function used to define test cases that test eden+mercurial. # # This decorator creates multiple TestCase subclasses from a single input # class. This allows us to re-run the same test code with several different # mercurial extension configurations. # # The test case subclasses will have different suffixes to identify their # configuration. Currently for a given input test class named "MyTest", # this will create subclasses named: # - "MyTestFlat": configures hg using the vanilla flat manifest # - "MyTestTree": configures hg using treemanifest # - "MyTestTreeOnly": configures hg using treemanifest.treeonly hg_test = testcase.test_replicator(_replicate_hg_test)