From 402fe9b4898c3c7608596eb9ed9d3ce647a963ef Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Mon, 15 Jun 2009 20:34:37 -0400 Subject: Added 'skip' as a config option. Individual tests or whole dirs can be skipped by adding 'skip=1' to test.cfg. --- markdown/tests/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/markdown/tests/__init__.py b/markdown/tests/__init__.py index dfe4d99..d421ed0 100644 --- a/markdown/tests/__init__.py +++ b/markdown/tests/__init__.py @@ -67,18 +67,21 @@ class CheckSyntax(object): def __call__(self, file, config): """ Compare expected output to actual output and report result. """ + cfg_section = get_section(file, config) + if config.getboolean(cfg_section, 'skip'): + raise nose.plugins.skip.SkipTest, 'Test skipped per config.' input_file = file + ".txt" input = codecs.open(input_file, encoding="utf-8").read() output_file = file + ".html" expected_output = codecs.open(output_file, encoding="utf-8").read() output = markdown.markdown(input, **get_args(file, config)) - if tidy and config.getboolean(get_section(file, config), 'normalize'): + if tidy and config.getboolean(cfg_section, 'normalize'): # Normalize whitespace before comparing. expected_output = normalize(expected_output) output = normalize(output) - elif config.getboolean(get_section(file, config), 'normalize'): + elif config.getboolean(cfg_section, 'normalize'): # Tidy is not available. Skip this test. - raise nose.plugins.skip.SkipTest, 'Skipped test. Tidy not available in system.' + raise nose.plugins.skip.SkipTest, 'Test skipped. Tidy not available in system.' diff = [l for l in difflib.unified_diff(expected_output.splitlines(True), output.splitlines(True), output_file, @@ -94,7 +97,8 @@ def TestSyntax(): config = util.CustomConfigParser({'extensions': '', 'safe_mode': False, 'output_format': 'xhtml1', - 'normalize': '0'}) + 'normalize': '0', + 'skip': '0'}) config.read(os.path.join(dir_name, 'test.cfg')) # Loop through files and generate tests. for file in files: -- cgit v1.2.3