2008-06-05 03:58:43 -05:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Sphinx unit test driver
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
This script runs the Sphinx unit test suite.
|
|
|
|
|
2014-03-01 01:18:16 -06:00
|
|
|
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
2009-01-03 04:57:07 -06:00
|
|
|
:license: BSD, see LICENSE for details.
|
2008-06-05 03:58:43 -05:00
|
|
|
"""
|
2014-01-19 04:17:10 -06:00
|
|
|
from __future__ import print_function
|
2008-06-05 03:58:43 -05:00
|
|
|
|
2014-09-21 10:17:02 -05:00
|
|
|
import os
|
2008-06-05 03:58:43 -05:00
|
|
|
import sys
|
2014-09-21 10:17:02 -05:00
|
|
|
import traceback
|
|
|
|
|
|
|
|
from path import path
|
|
|
|
|
|
|
|
testroot = os.path.dirname(__file__) or '.'
|
|
|
|
sys.path.insert(0, os.path.abspath(os.path.join(testroot, os.path.pardir)))
|
|
|
|
|
|
|
|
# check dependencies before testing
|
|
|
|
print('Checking dependencies...')
|
|
|
|
for modname in ('nose', 'mock', 'six', 'docutils', 'jinja2', 'pygments',
|
|
|
|
'snowballstemmer', 'babel'):
|
|
|
|
try:
|
|
|
|
__import__(modname)
|
|
|
|
except ImportError as err:
|
2014-09-21 10:32:52 -05:00
|
|
|
if modname == 'mock' and sys.version_info[0] == 3:
|
|
|
|
continue
|
2014-09-21 10:17:02 -05:00
|
|
|
traceback.print_exc()
|
|
|
|
print('The %r package is needed to run the Sphinx test suite.' % modname)
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
# find a temp dir for testing and clean it up now
|
|
|
|
os.environ['SPHINX_TEST_TEMPDIR'] = \
|
|
|
|
os.path.abspath(os.path.join(testroot, 'build')) \
|
|
|
|
if 'SPHINX_TEST_TEMPDIR' not in os.environ \
|
|
|
|
else os.path.abspath(os.environ['SPHINX_TEST_TEMPDIR'])
|
|
|
|
tempdir = path(os.environ['SPHINX_TEST_TEMPDIR'])
|
|
|
|
print('Temporary files will be placed in %s.' % tempdir)
|
|
|
|
if tempdir.exists():
|
|
|
|
tempdir.rmtree()
|
|
|
|
tempdir.makedirs()
|
2011-04-12 17:54:14 -05:00
|
|
|
|
2011-05-15 04:15:20 -05:00
|
|
|
print('Running Sphinx test suite...')
|
2014-09-21 10:17:02 -05:00
|
|
|
import nose
|
2008-06-05 03:58:43 -05:00
|
|
|
nose.main()
|