Commit e92e9b3a by Chris Jerdonek

Added the README doctests to `python setup.py test`.

parent 69c4e22b
......@@ -15,7 +15,8 @@ _TESTS_DIR = os.path.dirname(pystache.tests.__file__)
DATA_DIR = os.path.join(_TESTS_DIR, 'data') # i.e. 'pystache/tests/data'.
EXAMPLES_DIR = os.path.dirname(examples.__file__)
SPEC_TEST_DIR = os.path.join(os.path.dirname(pystache.__file__), '..', 'ext', 'spec', 'specs')
PROJECT_DIR = os.path.join(os.path.dirname(pystache.__file__), '..')
SPEC_TEST_DIR = os.path.join(PROJECT_DIR, 'ext', 'spec', 'specs')
def get_data_path(file_name):
......
# coding: utf-8
"""
Creates unittest.TestSuite instances for the doctests in the project.
"""
# This module follows the guidance documented here:
#
# http://docs.python.org/library/doctest.html#unittest-api
#
import os
import doctest
import unittest
import pystache
from pystache.tests.common import PROJECT_DIR
# The paths to text files (i.e. non-module files) containing doctests.
# Paths should be OS-specific and relative to the project directory.
text_file_paths = ['README.rst']
def load_tests(loader, tests, ignore):
# Since module_relative is False in our calls to DocFileSuite below,
# paths should be OS-specific. Moreover, we choose absolute paths
# so that the current working directory does not come into play.
# See the following for more info--
#
# http://docs.python.org/library/doctest.html#doctest.DocFileSuite
#
paths = [os.path.join(PROJECT_DIR, path) for path in text_file_paths]
tests.addTests(doctest.DocFileSuite(*paths, module_relative=False))
return tests
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment