Skip to content

Rednose and processes do not work togeather #14

Description

@bartlomiej-kurek

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions