Skip to content

Instantly share code, notes, and snippets.

@geographika
Created October 10, 2012 18:35
Show Gist options
  • Save geographika/3867554 to your computer and use it in GitHub Desktop.
Save geographika/3867554 to your computer and use it in GitHub Desktop.
node template sample
from nose.plugins import Plugin
class HtmlOutput(Plugin):
"""
This is the plugin class
A simple HTMLPlugin can be seen at https://github.com/nose-devs/nose/blob/master/examples/html_plugin/htmlplug.py
However this does not use templates
"""
pass
import nose
folder = r"C:\PathToScripts"
my_template = "myjijnatemplate.txt"
# create a new instance of the plugin class
# and pass in a template here
my_plugin = HtmlOutput(my_template)
# the following call works with other nose plugins
result = nose.run(argv=['-w', folder, "-v", "--with-html-output"], plugins=[my_plugin])
# result should now be a string or StringIO with the nicely formatted HTML
# tests in different folders could be run and then the HTML added to a master HTML page with many tests..
# HTML can then be saved as a file, or returned directly via Flask or Bottle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment