Git Product home page Git Product logo

rednose's Introduction

rednose

rednose is a nosetests plugin for adding colour (and readability) to nosetest console results.

rednose_example.png

Installation:

pip install rednose

or from the source:

python setup.py install

Rednose officially supports Python 2.7, 3.4, and 3.5.

Usage:

nosetests --rednose

or:

export NOSE_REDNOSE=1
nosetests

Rednose by default uses auto-colouring, which will only use colour if you're running it on a terminal (i.e not piping it to a file). To control colouring, use one of:

nosetests --rednose --force-color
nosetests --no-color

(you can also control this by setting the environment variable NOSE_REDNOSE_COLOR to 'force' or 'no')

Rednose by default prints file paths relative to the working directory. If you want the full path in the traceback then use:

nosetests --rednose --full-file-path

Rednose by default prints error style formating for skipped tests, to supress this use:

nosetests --rednose --hide-skips

Rednose supports printing the test results mid run as well as at the end, to enable it use:

nosetests --rednose --immediate

rednose's People

Contributors

igalarzab avatar jbkahn avatar madjar avatar northisup avatar oinume avatar rzilleruelo avatar timbertson avatar wojcikstefan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rednose's Issues

no such option: --rednose

Hello, I'm tryng to use the rednose plugin, but when I install it (pip3), nose doesn't seem's to recognize it.

nosetests version 1.3.7

    debian➜  test  ᐅ  nosetests --rednose
    Usage: nosetests [options]

    nosetests: error: no such option: --rednose

Thanks!

Add LICENSE and MANIFEST

Hey-lo,

I'm building a version of rednose using conda for conda-forge. When possible, we include a link to the license file in the meta.yaml specification for the build; doing so requires the license be indexed in an explicit MANIFEST.in file so that it gets included in the source distribution. Would you consider adding both a an actual license file and a MANIFEST.in that bundles the license in the next release? Also, can you please specify if you're using a BSD 2-Clause or a BSD 3-Clause license? "BSD" leaves it a bit ambiguous :(.

Add Screenshot to Readme

Because it would be nice to see how the output looks without having to download the library and some some test suite with it.

Problem with skipped test on Jenkins (Build step 'Console output (build log) parsing' changed build result to FAILURE)

I have problem with skipped tests. (We use message from skipped test in output for test maintaining and can't hide them.)
For example we have failed test:

======================================================================
1) SKIP: Testing some feature
----------------------------------------------------------------------
   No Traceback
   Exception: http://jira:5000/browse/KA-123456

------------------------------------------

When I run it with jenkins I have failed BUILD because output parser defines "Exception" in output.
It is better to use some other word, not "Exception" for skipped test.

** And also is confused that this skipped message has RED color. Will be more better - blue

SOME SCREENSHOTS:

rednose

rednose2

Error on python3

Traceback (most recent call last):
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 210, in run
    self.setUp()
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 293, in setUp
    self.setupContext(ancestor)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 316, in setupContext
    try_run(context, names)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/util.py", line 471, in try_run
    return func()
  File "/home/jenkins/workspace/NicosRunTestPy3/custom/resi/test_resi/test_proxy.py", line 14, in setup_module
    raise SkipTest('RESI specific Nonius libs not present')
unittest.case.SkipTest: RESI specific Nonius libs not present

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jenkins/pythonvenvs/nicos-py3-new/bin/nosetests", line 11, in <module>
    sys.exit(run_exit())
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/core.py", line 121, in __init__
    **extra_args)
  File "/usr/lib/python3.4/unittest/main.py", line 93, in __init__
    self.runTests()
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/core.py", line 207, in runTests
    result = self.testRunner.run(self.test)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/core.py", line 62, in run
    test(result)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 178, in __call__
    return self.run(*arg, **kw)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 225, in run
    test(orig)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 178, in __call__
    return self.run(*arg, **kw)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 225, in run
    test(orig)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 178, in __call__
    return self.run(*arg, **kw)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 225, in run
    test(orig)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 178, in __call__
    return self.run(*arg, **kw)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 225, in run
    test(orig)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 178, in __call__
    return self.run(*arg, **kw)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/suite.py", line 215, in run
    result.addError(self, self._exc_info())
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/nose/proxy.py", line 132, in addError
    self.result.addError(self.test, self._prepareErr(err))
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/rednose.py", line 251, in addError
    self._generate_and_add_test_report(error, test, err)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/rednose.py", line 240, in _generate_and_add_test_report
    report = self._report_test(len(self.test_failures_and_exceptions), type_, test, err)
  File "/home/jenkins/pythonvenvs/nicos-py3-new/lib/python3.4/site-packages/rednose.py", line 295, in _report_test
    test_id = self.ids.get(test.address(), self.total)
AttributeError: 'ContextSuite' object has no attribute 'address'

Rednose and processes do not work togeather

Hi, I've run into a bizarre issue with rednose, python 3.5.2, Ubuntu 16.04.
Problem: when multiple inheritance is used rednose discards the failure. It depends on the order of defining test classes/methods.

The code to reproduce the problem:
$ cat test_rednose.py

import unittest


class FrontendCase(unittest.TestCase):
    pass

class BackendCase(unittest.TestCase):
    pass

class BackendUserCase(BackendCase):
    pass

class ExistingBackendUserCase(BackendUserCase):
    pass

class FrontendUserCase(FrontendCase, BackendUserCase):
    pass

class ExistingFrontendUserCase(FrontendUserCase, ExistingBackendUserCase):
    pass

class Test_0(FrontendUserCase):
    def test_dummy(self):
        pass


class Test_1(ExistingFrontendUserCase):
    def test_assertion(self):
        print("Should fail")
        self.assertTrue(False)

$ cat nosetests.cfg

[nosetests]
verbosity = 1
with-doctest = 0
logging-level = DEBUG
logging-format = "%(asctime)s %(name)-12s %(levelname)-8s %(module)s:%(lineno)s %(message)s"
nocapture = 1
nologcapture = 1
rednose = 1
processes = 1

Run it:


$ nosetests -c nosetests.cfg test_rednose.py 
Should fail
.
----------------------------------------------------------------------
Ran 1 test in 0.031s

OK

Now, comment out rednose in nosetests.cfg and run again:

$ grep -v rednose nosetests.cfg > nosetests.without_rednose.cfg
$ nosetests -c nosetests.without_rednose.cfg test_rednose.py 
.F
======================================================================
FAIL: test_assertion (test_rednose.Test_1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_rednose.py", line 30, in test_assertion
    self.assertTrue(False)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 2 tests in 0.020s

FAILED (failures=1)

Voila, finally assertTrue(False) fails as it should.

This issue doesn't seem to be related to "--processes" in nosetests.
What is really bizarre is that:
a) if we just remove Test_0::test_dummy method (leaving Test_0 class empty), the assertion will properly fail.
b) The test method in Test_1 class is actually executed up to that assertion point.

I didn't debug rednose itself.

$ python -V
Python 3.5.2
$ uname -rmpov
4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 GNU/Linux

Colorize coverage output

When you run nose with --with-coverage a coverage table will be displayed. But it is not colorized. I think it would be nice to colorize high coverage percentages in green and low ones in red.

Rednose makes Py2.6 builds fail

Hi there,

I just noticed while doing some work on https://github.com/MongoEngine/mongoengine/ that their Py2.6 tests fail and the issue can be traced back to rednose (see the traceback at the bottom of this issue). Removing your package fixes the issue.

For debugging, compare a failed build (e.g. https://travis-ci.org/MongoEngine/mongoengine/jobs/167092804) with a fixed build (e.g. https://travis-ci.org/MongoEngine/mongoengine/jobs/169038786).

Unfortunately, I don't know enough about this package to help.

======================================================================
1) ERROR: test_binary_field_primary_filter_by_binary_pk_as_str (tests.FieldTest)
----------------------------------------------------------------------
   Traceback (most recent call last):
    .tox/py26-mg27/lib/python2.6/site-packages/nose/case.py line 133 in run
      self.runTest(result)
    .tox/py26-mg27/lib/python2.6/site-packages/nose/case.py line 151 in runTest
      test(result)
    .tox/py26-mg27/lib/python2.6/site-packages/nose/proxy.py line 132 in addError
      self.result.addError(self.test, self._prepareErr(err))
    .tox/py26-mg27/lib/python2.6/site-packages/rednose.py line 261 in addError
      self.addSkip(test, err)
    .tox/py26-mg27/lib/python2.6/site-packages/rednose.py line 275 in addSkip
      skip_message = "#{test_id} {test_location} ... ".format(test_id=self._get_id(test), test_location=test.context.__file__)
   AttributeError: type object 'FieldTest' has no attribute '__file__'

Test suite stuck on Python 2

All tests are passing here, but it gets stuck (does not exit) right after saying OK here with python 2.7.15, nose 1.3.7.

running test
running egg_info
creating rednose.egg-info
writing requirements to rednose.egg-info/requires.txt
writing rednose.egg-info/PKG-INFO
writing top-level names to rednose.egg-info/top_level.txt
writing dependency_links to rednose.egg-info/dependency_links.txt
writing entry points to rednose.egg-info/entry_points.txt
writing manifest file 'rednose.egg-info/SOURCES.txt'
reading manifest file 'rednose.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'rednose.egg-info/SOURCES.txt'
running build_ext
test_colored_result (test_files.new_tests.TestRedNose) ... ok
test_colored_result (test_files.new_tests.TestRedNoseEncoding) ... ok
test_colored_result (test_files.new_tests.TestRedNoseEncodingWithLiterals) ... ok
test_colored_result (test_files.new_tests.TestRedNoseSampleTests) ... ok
test_colored_result (test_files.new_tests.TestRedNoseSkipInClass) ... oh noes, it's gonna blow!
ok
test_colored_result (test_files.new_tests.TestRedNoseWithId) ... ok

----------------------------------------------------------------------
Ran 6 tests in 0.160s

OK

The problem is not present on Python 3, though.

Slooow tests with multiprocess run

Hello!

We have a lot of tests (11k) and use nose to run them in many processes with --processes=$NCPU flag.

The complete line is nosetests --rednose -s --processes=$NCPU --process-timeout=300 tests
But rednose slows tests up to 10 times.

How it can be profiled?

nose==1.2.1
rednose==1.2.1

Pin colorama version

Hi!
Colorama version 0.4.1 dropped support of python 3.4.
For running in unit testing, it would be very convenient to have the version of colorama pinned to 0.4.0, that still supports python 3.4, if possible.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.