aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-04-29 00:59:06 -0400
committerWaylan Limberg <waylan@gmail.com>2011-04-29 00:59:06 -0400
commitefa244322af59350056ffe3b93f7d4728d5ce61e (patch)
treef21ef20608b38d35f05e4e65504cd9406e2c6e68
parentad83ad5c426b508ba0ace30ea83b3e60ec23b8ef (diff)
downloadmarkdown-efa244322af59350056ffe3b93f7d4728d5ce61e.tar.gz
markdown-efa244322af59350056ffe3b93f7d4728d5ce61e.tar.bz2
markdown-efa244322af59350056ffe3b93f7d4728d5ce61e.zip
The Testing Framework will now pass any non-reserved args set in test.cfg files as keyword arguments to Markdown for a given syntax test. As Markdown ignores unknown args, this should be safe and will allow testing of any newly added keywords without additional modification of the testing framework.
-rw-r--r--docs/test_suite.txt6
-rw-r--r--tests/__init__.py11
-rw-r--r--tests/util.py4
3 files changed, 11 insertions, 10 deletions
diff --git a/docs/test_suite.txt b/docs/test_suite.txt
index e529275..5cad250 100644
--- a/docs/test_suite.txt
+++ b/docs/test_suite.txt
@@ -98,10 +98,6 @@ settings under a specific file section will override anything in the
Below are each of the config options available and the defaults used when they
are not explicitly set.
-* `extensions`: A comma separated list of extensions to use with the test.
- Defaults to an empty list.
-* `safe_mode`: Switches safe_mode on and off. Defaults to `False` (off).
-* `output_format`: Defines the expected output_format. Defaults to `xhtml1`.
* `normalize`: Switches whitespace normalization of the test output on or off.
Defaults to `0` (off). Note: This requires that [uTidylib] be installed on
the system. Otherwise the test will be skipped, regardless of any other
@@ -111,6 +107,8 @@ are not explicitly set.
from other implementations.
* `output_ext`: Extension of output file. Defaults to `.html`. Useful for tests
from other implementations.
+* Any keyword arguement accepted my Markdown. If not set, Markdown's defaults
+ are used.
## Unit Tests
diff --git a/tests/__init__.py b/tests/__init__.py
index bad2a37..8fbc5d9 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -43,8 +43,10 @@ def get_args(file, config):
""" Get args to pass to markdown from config for a given file. """
args = {}
section = get_section(file, config)
- for key in ['extensions', 'safe_mode', 'output_format']:
- args[key] = config.get(section, key)
+ for key, v in config.items(section):
+ # Filter out args unique to testing framework
+ if key not in ['normalize', 'skip', 'input_ext', 'output_ext']:
+ args[key] = config.get(section, key)
return args
def normalize(text):
@@ -97,10 +99,7 @@ class CheckSyntax(object):
def TestSyntax():
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',
- 'normalize': '0',
+ config = util.CustomConfigParser({'normalize': '0',
'skip': '0',
'input_ext': '.txt',
'output_ext': '.html'})
diff --git a/tests/util.py b/tests/util.py
index aae87be..a960104 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -12,4 +12,8 @@ class CustomConfigParser(SafeConfigParser):
return value.split(',')
else:
return []
+ if value.lower() in ['yes', 'true', 'on']:
+ return True
+ if value.lower() in ['no', 'false', 'off']:
+ return False
return value