This commit is contained in:
Georg Brandl 2011-05-15 11:15:20 +02:00
parent 4fb8139f36
commit 3c2662580a
3 changed files with 8 additions and 10 deletions

View File

@ -29,20 +29,20 @@ sys.path.insert(0, path.join(path.dirname(__file__), path.pardir))
try: try:
import nose import nose
except ImportError: except ImportError:
print("The nose package is needed to run the Sphinx test suite.") print('The nose package is needed to run the Sphinx test suite.')
sys.exit(1) sys.exit(1)
try: try:
import docutils import docutils
except ImportError: except ImportError:
print("Sphinx requires the docutils package to be installed") print('Sphinx requires the docutils package to be installed.')
sys.exit(1) sys.exit(1)
try: try:
import jinja2 import jinja2
except ImportError: except ImportError:
print("Sphinx requires the jinja2 package to be installed") print('Sphinx requires the jinja2 package to be installed.')
sys.exit(1) sys.exit(1)
print("Running Sphinx test suite...") print('Running Sphinx test suite...')
nose.main() nose.main()

View File

@ -11,8 +11,8 @@
import os import os
import re import re
import htmlentitydefs
import sys import sys
import htmlentitydefs
from StringIO import StringIO from StringIO import StringIO
try: try:

View File

@ -193,10 +193,8 @@ def with_app(*args, **kwargs):
def gen_with_app(*args, **kwargs): def gen_with_app(*args, **kwargs):
""" """
Make a TestApp with args and kwargs, pass it to the test and clean up Decorate a test generator to pass a TestApp as the first argument to the
properly. The wrapped function is assumed to be a generator and the test generator when it's executed.
wrapper function is itself a generator that will iterate over the
values of the wrapped function and yield them.
""" """
def generator(func): def generator(func):
@wraps(func) @wraps(func)
@ -226,7 +224,7 @@ def write_file(name, contents, encoding=None):
contents = contents.encode('ascii') contents = contents.encode('ascii')
else: else:
mode = 'w' mode = 'w'
f = open(str(name), 'wb', encoding=encoding) f = open(str(name), mode, encoding=encoding)
f.write(contents) f.write(contents)
f.close() f.close()