bobber6467 / python-nose

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

--with-id and --processes=n don't play together #446

Open GoogleCodeExporter opened 8 years ago

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

1. use this simple 2-case file

$ cat > tests.py

def test1() assert True
def test2(): assert True

2. Run:

$ nosetests tests.py -verbose=2 --processes=2 --with-id

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

Expected a success, instead I got:

ERROR
ERROR

======================================================================
ERROR: tests.test1
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/nose/case.py", line 133, in run
    self.runTest(result)
  File "/Library/Python/2.6/site-packages/nose/case.py", line 151, in runTest
    test(result)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 300, in __call__
    return self.run(*args, **kwds)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 266, in run
    result.startTest(self)
  File "/Library/Python/2.6/site-packages/nose/proxy.py", line 161, in startTest
    self.plugins.startTest(self.test)
  File "/Library/Python/2.6/site-packages/nose/plugins/manager.py", line 94, in __call__
    return self.call(*arg, **kw)
  File "/Library/Python/2.6/site-packages/nose/plugins/manager.py", line 162, in simple
    result = meth(*arg, **kw)
  File "/Library/Python/2.6/site-packages/nose/plugins/testid.py", line 272, in startTest
    self.write('#%s ' % self.tests[adr])
  File "/Library/Python/2.6/site-packages/nose/plugins/testid.py", line 306, in write
    self.stream.write(output)
AttributeError: 'TestId' object has no attribute 'stream'

======================================================================
ERROR: tests.test2
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/nose/case.py", line 133, in run
    self.runTest(result)
  File "/Library/Python/2.6/site-packages/nose/case.py", line 151, in runTest
    test(result)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 300, in __call__
    return self.run(*args, **kwds)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/unittest.py", line 266, in run
    result.startTest(self)
  File "/Library/Python/2.6/site-packages/nose/proxy.py", line 161, in startTest
    self.plugins.startTest(self.test)
  File "/Library/Python/2.6/site-packages/nose/plugins/manager.py", line 94, in __call__
    return self.call(*arg, **kw)
  File "/Library/Python/2.6/site-packages/nose/plugins/manager.py", line 162, in simple
    result = meth(*arg, **kw)
  File "/Library/Python/2.6/site-packages/nose/plugins/testid.py", line 272, in startTest
    self.write('#%s ' % self.tests[adr])
  File "/Library/Python/2.6/site-packages/nose/plugins/testid.py", line 306, in write
    self.stream.write(output)
AttributeError: 'TestId' object has no attribute 'stream'

----------------------------------------------------------------------
Ran 0 tests in 0.053s

FAILED (errors=2)

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

$ nosetests --version
nosetests version 1.0.0

I'm on Mac OS X 10.6.8

Original issue reported on code.google.com by anh.hai....@gmail.com on 16 Aug 2011 at 7:30

GoogleCodeExporter commented 8 years ago
Looks like this is still a problem in version 1.3.1. If you run this without 
the versbose flag (e.g. nosetests --processes=4 --with-id), the tests do not 
fail, but the .noseids file is populated with only a few lines of data, such 
that the --failed flag is useless (all tests get rerun, regardless of whether 
they passed or failed.

Any chance someone is working on a fix for this?

Original comment by nguilf...@gmail.com on 29 Apr 2014 at 1:01

GoogleCodeExporter commented 8 years ago
I don't have a patch for this issue, but I built a plugin to help get around it:
https://github.com/dustinkeitel/goober

This plugin prints out 'nosetests -v' plus the paths to those failing tests 
upon the completion of a test run. The idea is to make it as easy as possible 
to just run the troublesome tests from a multiprocess test run.

You run: nosetests --goober --processes=-1 path/to/tests
The output looks like:

YOU SHOULD RE-RUN: 
nosetests -v --goober path/to/failed.py:test_1 path/to/errored.py:test_2 

Original comment by dustin.k...@gmail.com on 28 Aug 2014 at 5:39

GoogleCodeExporter commented 8 years ago
Hi Dustin. I finally got around to integrating goober and in combination with 
sed to automate retries, it works great. Many thanks!

Original comment by nguilf...@gmail.com on 6 Jan 2015 at 1:08

p00j4 commented 7 years ago

hi @GoogleCodeExporter thanks for noting this down here, but can you please tell me how did you enable the goober option, for me it shows "no such option: --goober "