nose-devs/nose — Issue #230: warning referencing wrong line of source code
Author: jpellerin
Created: 2011-12-14 16:04:39+00:00
State: open

What steps will reproduce the problem?
1. Run a test that uses nose.plugins.doctests.run

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

Expect: a warning referencing the source line that uses the run() function
Get: a warning referencing the line of the run() function itself

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

http://python-nose.googlecode.com/svn/branches/0.10.0-stable revision 358

Please provide any additional information below.

Fix is to add stacklevel arg to warnins.warn. I haven't checked for
similar problems elsewhere.

Index: nose/plugins/doctests.py
===================================================================
--- nose/plugins/doctests.py (revision 358)
+++ nose/plugins/doctests.py (working copy)
@@ -235,6 +235,7 @@
"""
import warnings
warnings.warn("run() has been moved to nose.plugins.plugintest. Please "
- "update your imports.", category=DeprecationWarning)
+ "update your imports.", category=DeprecationWarning,
+ stacklevel=2)
from nose.plugins.plugintest import run
run(*arg, **kw)

Google Code Info:
Issue #: 108
Author: j...@pobox.com
Created On: 2007-09-29T14:20:08.000Z
Closed On: 2007-10-01T14:58:33.000Z