aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2009-06-15 20:34:37 -0400
committerWaylan Limberg <waylan@gmail.com>2009-06-15 20:34:37 -0400
commit402fe9b4898c3c7608596eb9ed9d3ce647a963ef (patch)
tree3a647a7911363e82ee525f76f38d6d852f7404aa
parent8f7c8ebb8117aad3649a9ba5ee0c5f4a201f9925 (diff)
downloadmarkdown-402fe9b4898c3c7608596eb9ed9d3ce647a963ef.tar.gz
markdown-402fe9b4898c3c7608596eb9ed9d3ce647a963ef.tar.bz2
markdown-402fe9b4898c3c7608596eb9ed9d3ce647a963ef.zip
Added 'skip' as a config option. Individual tests or whole dirs can be skipped by adding 'skip=1' to test.cfg.
-rw-r--r--markdown/tests/__init__.py12
1 files 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: