Bold link?

This commit is contained in:
Pedro Algarvio 2013-05-23 18:07:41 +01:00
parent 140ac3c602
commit d80c36842d
3 changed files with 38 additions and 2 deletions

View file

@ -9,7 +9,8 @@ script runs through a series of checks to determine operating system type and ve
install the `Salt`_ binaries using the appropriate methods. install the `Salt`_ binaries using the appropriate methods.
**In case you found a bug, please read** `I found a bug`_ **first before submitting a new issue.** **In case you found a bug, please read** `**I found a bug**`_ **first before submitting a new
issue.**
One Line Bootstrap One Line Bootstrap

View file

@ -33,6 +33,8 @@ if sys.version_info < (2, 7):
expectedFailure, expectedFailure,
TestSuite, TestSuite,
skipIf, skipIf,
TestResult,
Testrogram
) )
except ImportError: except ImportError:
raise SystemExit('You need to install unittest2 to run the salt tests') raise SystemExit('You need to install unittest2 to run the salt tests')
@ -44,6 +46,8 @@ else:
expectedFailure, expectedFailure,
TestSuite, TestSuite,
skipIf, skipIf,
TestResult,
TestProgram
) )

View file

@ -19,6 +19,7 @@ import tempfile
from bootstrap.unittesting import TestLoader, TextTestRunner from bootstrap.unittesting import TestLoader, TextTestRunner
from bootstrap.ext.os_data import GRAINS from bootstrap.ext.os_data import GRAINS
from bootstrap.ext.HTMLTestRunner import HTMLTestRunner
try: try:
from bootstrap.ext import console from bootstrap.ext import console
width, height = console.getTerminalSize() width, height = console.getTerminalSize()
@ -39,6 +40,11 @@ XML_OUTPUT_DIR = os.environ.get(
tempfile.gettempdir(), 'xml-test-reports' tempfile.gettempdir(), 'xml-test-reports'
) )
) )
HTML_OUTPUT_DIR = os.environ.get(
'HTML_OUTPUT_DIR', os.path.join(
tempfile.gettempdir(), 'html-test-results'
)
)
def print_header(header, sep='~', top=True, bottom=True, inline=False, def print_header(header, sep='~', top=True, bottom=True, inline=False,
@ -70,7 +76,7 @@ def run_suite(opts, path, display_name, suffix='[!_]*.py'):
''' '''
loader = TestLoader() loader = TestLoader()
if opts.name: if opts.name:
tests = tests = loader.loadTestsFromName(display_name) tests = loader.loadTestsFromName(display_name)
else: else:
tests = loader.discover(path, suffix, TEST_DIR) tests = loader.discover(path, suffix, TEST_DIR)
@ -84,6 +90,23 @@ def run_suite(opts, path, display_name, suffix='[!_]*.py'):
output=XML_OUTPUT_DIR, output=XML_OUTPUT_DIR,
verbosity=opts.verbosity verbosity=opts.verbosity
).run(tests) ).run(tests)
elif opts.html_out:
if not os.path.isdir(HTML_OUTPUT_DIR):
os.makedirs(HTML_OUTPUT_DIR)
for test in tests._tests:
for t in test:
print 2, t._tests
if not t._tests:
continue
print str(t._tests[0].__class__.__name__)
print dir(test)
exit(1)
runner = HTMLTestRunner(
stream=open(HTML_OUTPUT_DIR, 'w'),
verbosity=opts.verbosity
).run(tests)
TEST_RESULTS.append((header, runner))
else: else:
runner = TextTestRunner( runner = TextTestRunner(
verbosity=opts.verbosity verbosity=opts.verbosity
@ -153,6 +176,14 @@ def main():
XML_OUTPUT_DIR XML_OUTPUT_DIR
) )
) )
output_options_group.add_option(
'--html-out',
default=False,
action='store_true',
help='HTML test runner output(Output directory: {0})'.format(
HTML_OUTPUT_DIR
)
)
output_options_group.add_option( output_options_group.add_option(
'--no-clean', '--no-clean',
default=False, default=False,