diff options
author | Waylan Limberg <waylan@gmail.com> | 2012-12-14 13:31:41 -0500 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2012-12-14 13:31:41 -0500 |
commit | 9bcd7b8763627c64184b0bf147ec1830fde0a5dc (patch) | |
tree | c4ae05ca3e9bd76d9fb3120e0672bda29abec200 /tests/__init__.py | |
parent | a974fd6e902ccc9e5b782707344d9af734b169b6 (diff) | |
download | markdown-9bcd7b8763627c64184b0bf147ec1830fde0a5dc.tar.gz markdown-9bcd7b8763627c64184b0bf147ec1830fde0a5dc.tar.bz2 markdown-9bcd7b8763627c64184b0bf147ec1830fde0a5dc.zip |
Testing framework now runs on Python 2 & 3 unmodified.
Diffstat (limited to 'tests/__init__.py')
-rw-r--r-- | tests/__init__.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index 4722e33..bb56bd4 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,4 @@ -from __future__ import with_statement + import os import markdown import codecs @@ -6,11 +6,11 @@ import difflib try: import nose except ImportError: - raise ImportError, "The nose testing framework is required to run " \ + raise ImportError("The nose testing framework is required to run " \ "Python-Markdown tests. Run `easy_install nose` " \ - "to install the latest version." -import util -from plugins import HtmlOutput, Markdown + "to install the latest version.") +from . import util +from .plugins import HtmlOutput, Markdown try: import tidy except ImportError: @@ -84,7 +84,7 @@ class CheckSyntax(object): """ Compare expected output to actual output and report result. """ cfg_section = get_section(file, config) if config.get(cfg_section, 'skip'): - raise nose.plugins.skip.SkipTest, 'Test skipped per config.' + raise nose.plugins.skip.SkipTest('Test skipped per config.') input_file = file + config.get(cfg_section, 'input_ext') with codecs.open(input_file, encoding="utf-8") as f: input = f.read() @@ -99,7 +99,7 @@ class CheckSyntax(object): output = normalize(output) elif config.get(cfg_section, 'normalize'): # Tidy is not available. Skip this test. - raise nose.plugins.skip.SkipTest, 'Test skipped. 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, @@ -125,17 +125,17 @@ def generate(file, config): """ Write expected output file for given input. """ cfg_section = get_section(file, config) if config.get(cfg_section, 'skip'): - print 'Skipping:', file + print('Skipping:', file) return None input_file = file + config.get(cfg_section, 'input_ext') output_file = file + config.get(cfg_section, 'output_ext') if not os.path.isfile(output_file) or \ os.path.getmtime(output_file) < os.path.getmtime(input_file): - print 'Generating:', file + print('Generating:', file) markdown.markdownFromFile(input=input_file, output=output_file, encoding='utf-8', **get_args(file, config)) else: - print 'Already up-to-date:', file + print('Already up-to-date:', file) def generate_all(): """ Generate expected output for all outdated tests. """ |