-
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dill doctests fail when run as python -m doctest
#49
Comments
I tried your test code in python2.7.7 with the latest dill (from github), and I didn't encounter the error.
Which version of The last line of your traceback is a common error. If there's some "intelligent" renaming of instances or one of the cases that python provides the wrong path for a object… |
Same: latest dill: $ python2 --version
Python 2.7.6
$ python2 -m doctest a.py
$ cat a.py
import dill
import doctest
def test_dill():
"""
>>> out = dill.dumps(lambda x: x)
"""
out = dill.dumps(lambda x: x)
doctest.testmod()
$ python2
Python 2.7.6 (default, Feb 26 2014, 12:07:17)
[GCC 4.8.2 20140206 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dill
>>> dill.__version__
'0.2b2.dev'
>>>
$ |
Well, that's wacky. I just installed a new Mint 17 virtualbox instance and had the same problem with it. Python version 2.7.6, Dill version '0.2.1' FWIW, the non-doctest "out =" assignment was overly-indented in what I pasted above, but that's immaterial. |
Could you put import dill
import doctest
dill.dill._trace(1)
def test_dill():
"""
>>> out = dill.dumps(lambda x: x)
"""
out = dill.dumps(lambda x: x)
doctest.testmod() in your file and run it, then paste the output? For reference, I get:
|
|
It didn't crash? |
Ah, didn't realize you were asking for output of
|
What's the value of |
Yes, sys.prefix was set to my virtualenv home. I've just tried it outside a virtualenv, and all works as expected. I tried the memorise branch of your fork, and it does indeed work inside virtualenvs too. Thanks! I'll close this then, with the assumption that the memorise branch will make it to dill master |
OK, hopefully it'll be soon, as its may solve quite a few issues like this. |
@distobj: memorize branch should make it in eventually, there are some speed and other issues that I'm concerned about, but they'll get worked out. Actually, I wanted to point out that dill has a few different variants on serialization that can be leveraged in cases where the vanilla |
I'll give the speed problem another go. Shall I make the memorise branch into a PR, so make comparison easier? |
@matsjoyce: I expect it will become a PR and get merged at some point. If you want to make it a PR now, then go ahead. |
I'm encountering problems running doctests via
python -m doctest
andnosetests --with-doctest
. This seems related to #18 (and also in PySpark, FWIW) but differs in thatdoctest.testmod()
executed inside the module doesn't trigger the problem. Sample code;So when executed via
python -m doctest
under Python 2.7.3, I get a long recursive stacktrace of save_module_dict and save_module calls, concluding with;The text was updated successfully, but these errors were encountered: