From 8b430d251b2518fa3303d7027f50268e0254b7a1 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sat, 30 May 2009 22:31:55 -0400 Subject: Moves tests to a subdir of the markdown lib. --- tests/__init__.py | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 tests/__init__.py (limited to 'tests/__init__.py') diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index 63ddf5b..0000000 --- a/tests/__init__.py +++ /dev/null @@ -1,44 +0,0 @@ -import os -import markdown -import codecs -import difflib -import nose -import util -from plugins import MdSyntaxError, HtmlOutput, MdSyntaxErrorPlugin -from test_apis import * - -test_dir = os.path.abspath(os.path.dirname(__file__)) - -def normalize(text): - return ['%s\n' % l for l in text.strip().split('\n')] - -def check_syntax(file, 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 = normalize(markdown.markdown(input, - config.get('DEFAULT', 'extensions'), - config.get('DEFAULT', 'safe_mode'), - config.get('DEFAULT', 'output_format'))) - diff = [l for l in difflib.unified_diff(normalize(expected_output), - output, output_file, - 'actual_output.html', n=3)] - if diff: - raise util.MdSyntaxError('Output from "%s" failed to match expected ' - 'output.\n\n%s' % (input_file, ''.join(diff))) - -def test_markdown_syntax(): - for dir_name, sub_dirs, files in os.walk(test_dir): - # Get dir specific config settings. - config = util.CustomConfigParser({'extensions': '', - 'safe_mode': False, - 'output_format': 'xhtml1'}) - config.read(os.path.join(dir_name, 'test.cfg')) - # Loop through files and generate tests. - for file in files: - root, ext = os.path.splitext(file) - if ext == '.txt': - yield check_syntax, os.path.join(dir_name, root), config - -nose.main(addplugins=[HtmlOutput(), MdSyntaxErrorPlugin()]) -- cgit v1.2.3