use colorama on windows

This commit is contained in:
Tim Cuthbertson 2015-06-13 18:21:28 +10:00
parent 111c2b60b5
commit 5a04018b1f
4 changed files with 9 additions and 1 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ dist
0inst
*.stamp
*-local.xml
gup

View File

@ -34,6 +34,10 @@ import linecache
import re
import time
colorama = None
if os.name == 'nt':
import colorama
import nose
import termstyle
@ -194,6 +198,8 @@ class RedNose(nose.plugins.Plugin):
self._print_test(skip, termstyle.blue)
def setOutputStream(self, stream):
if colorama:
stream = colorama.initialise.wrap_stream(stream, convert=True, strip=False, autoreset=False, wrap=True)
self.stream = stream
def report(self, stream):

View File

@ -109,6 +109,7 @@ nosetests --no-color
<requires interface="http://gfxmonk.net/dist/0install/python-termstyle.xml">
<version not-before="0.1.7"/>
</requires>
<requires interface="http://gfxmonk.github.io/0downstream/feeds/pypi/colorama.xml" os="Windows"/>
<implementation version="{version}" released="{date}">
<manifest-digest/>
<archive href="{archive}"/>

View File

@ -9,7 +9,7 @@ setup(
packages = find_packages(exclude=['test', 'test.*']),
description='coloured output for nosetests',
entry_points={'nose.plugins.0.10': ['NOSETESTS_PLUGINS = rednose:RedNose']},
install_requires=['setuptools', 'python-termstyle >=0.1.7'],
install_requires=['setuptools', 'termstyle >=0.1.7', 'colorama'],
long_description="\n**Note**: This package has been built automatically by\n`zero2pypi <http://gfxmonk.net/dist/0install/zero2pypi.xml>`_.\nIf possible, you should use the zero-install feed instead:\nhttp://gfxmonk.net/dist/0install/rednose.xml\n\n----------------\n\n=========\nrednose\n=========\n\nrednose is a `nosetests`_\nplugin for adding colour (and readability) to nosetest console results.\n\nInstallation:\n-------------\n::\n\n\teasy_install rednose\n\t\nor from the source::\n\n\t./setup.py develop\n\nUsage:\n------\n::\n\n\tnosetests --rednose\n\nor::\n\n\texport NOSE_REDNOSE=1\n\tnosetests\n\nRednose by default uses auto-colouring, which will only use\ncolour if you're running it on a terminal (i.e not piping it\nto a file). To control colouring, use one of::\n\n\tnosetests --rednose --force-color\n\tnosetests --no-color\n\n(you can also control this by setting the environment variable NOSE_REDNOSE_COLOR to 'force' or 'no')\n\n.. _nosetests: http://somethingaboutorange.com/mrl/projects/nose/\n",
name='rednose',
py_modules=['rednose'],