bobber6467 / python-nose

Automatically exported from code.google.com/p/python-nose
0 stars 0 forks source link

Can't test nose plug-in following examples in documentation #455

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Visit http://readthedocs.org/docs/nose/en/latest/plugins/testing.html
2. Use the code from the first example to create a new file (foo.py)
3. Run nosetests foo.py

What is the expected output? What do you see instead?

Nose should respond with 0 tests run (since there are no test_* methods on the 
test class). Instead, the test runner enters a loop (recursive?) and only stops 
on keyboard interrupt. Many traceback reporst are generated, the number 
proportional to the length of time nosetests is left running.

If I've mis-understood the purpose of the example code (you can use nose to 
test nose plugins, right?) some doc would be helpful. Help me understand the 
issue, and I'll be happy to create some documentation.

What version of the product are you using? On what operating system?

Nose 1.1.2 on Windows 7 x64

Please provide any additional information below.

Here's the full text of the file I'm using:
-------------
import unittest

from nose.plugins import Plugin, PluginTester

class FooPlugin(Plugin):
    pass

class Test_PluginFoo(PluginTester, unittest.TestCase):
    activate = '--with-foo'
    plugins = [FooPlugin()]

    def test_foo(self):
        assert False

    def makeSuite(self):
        class TC(unittest.TestCase):
            def runTest(self):
                raise ValueError('Bailing out!')
        return unittest.TestSuite([TC()])
-------------

Running nosetests.exe foo.py causes the loop.

Original issue reported on code.google.com by dogro...@gmail.com on 4 Oct 2011 at 10:04

GoogleCodeExporter commented 8 years ago
I don't have a windows machine to test but this works for me on Mac OS X.  I 
get:

$ nosetests foo.py 
F
======================================================================
FAIL: test_foo (foo.Test_PluginFoo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/kumar/tmp/nose-foo/foo.py", line 14, in test_foo
    assert False
AssertionError

----------------------------------------------------------------------
Ran 1 test in 0.064s

FAILED (failures=1)

I have no idea what would cause Nose to go into a loop on Windows.  Did you add 
nose.main() to the file or the code above exactly what's in your foo.py?  If 
you can pinpoint a nose bug on Windows please let us know about it.

Original comment by kumar.mcmillan on 10 Oct 2011 at 3:31