aboutsummaryrefslogtreecommitdiffstats
path: root/tests/__init__.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2009-05-30 22:31:55 -0400
committerWaylan Limberg <waylan@gmail.com>2009-06-05 22:25:51 -0400
commit8b430d251b2518fa3303d7027f50268e0254b7a1 (patch)
treec9265f6ce7024d400b6c8bb58c26bda6a97f86d5 /tests/__init__.py
parentcc452998dc1af441cf3f9c5d0c7287cb5de48c4a (diff)
downloadmarkdown-8b430d251b2518fa3303d7027f50268e0254b7a1.tar.gz
markdown-8b430d251b2518fa3303d7027f50268e0254b7a1.tar.bz2
markdown-8b430d251b2518fa3303d7027f50268e0254b7a1.zip
Moves tests to a subdir of the markdown lib.
Diffstat (limited to 'tests/__init__.py')
-rw-r--r--tests/__init__.py44
1 files changed, 0 insertions, 44 deletions
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()])