Averroes / simplejson

MIT License
0 stars 0 forks source link

Tests failing in 2.1.0 on Linux (amd64, python 2.6.4) #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
======================================================================
ERROR: test_make_scanner (simplejson.tests.test_speedups.TestDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/var/tmp/portage/dev-python/simplejson-2.1.0/work/simplejson-2.1.0/simplejson/t
ests/test_speedups.py",
line 8, in test_make_scanner
    self.assertRaises(AttributeError, scanner.c_make_scanner, 1)
  File "/usr/lib64/python2.6/unittest.py", line 336, in failUnlessRaises
    callableObj(*args, **kwargs)
TypeError: 'NoneType' object is not callable

======================================================================
ERROR: test_make_scanner (simplejson.tests.test_speedups.TestDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/var/tmp/portage/dev-python/simplejson-2.1.0/work/simplejson-2.1.0/simplejson/t
ests/test_speedups.py",
line 8, in test_make_scanner
    self.assertRaises(AttributeError, scanner.c_make_scanner, 1)
  File "/usr/lib64/python2.6/unittest.py", line 336, in failUnlessRaises
    callableObj(*args, **kwargs)
TypeError: 'NoneType' object is not callable

----------------------------------------------------------------------

Original issue reported on code.google.com by djc.ochtman on 11 Mar 2010 at 4:14

GoogleCodeExporter commented 9 years ago
Is this from tarball or svn?

Original comment by bob.ippo...@gmail.com on 11 Mar 2010 at 4:39

GoogleCodeExporter commented 9 years ago
Also, how were the tests invoked exactly? Can you please give a full command 
history for what exactly you did?

Original comment by bob.ippo...@gmail.com on 11 Mar 2010 at 4:41

GoogleCodeExporter commented 9 years ago
Got a tarball from PyPI. Tests invocation:

PYTHONPATH="build-${PYTHON_ABI}/lib" "$(PYTHON)" simplejson/tests/__init__.py

This happened through Gentoo's tools, so not easy to give a full history. Build 
step
is just python2.6 setup.py build -b build-2.6, though.

Original comment by djc.ochtman on 11 Mar 2010 at 4:46

GoogleCodeExporter commented 9 years ago
It looks like you are probably missing the headers for Python and the 
_speedups.so extension could not be built. 
It's a bug that these tests are failing, they should be skipped instead.

Original comment by bob.ippo...@gmail.com on 11 Mar 2010 at 4:51

GoogleCodeExporter commented 9 years ago
The speedup tests no longer run in trunk when speedups were not compiled. You 
should make sure that you 
have installed the headers for Python so that the extension gets built, 
otherwise this module is going to be 
slower than you would otherwise expect.

r226

Original comment by bob.ippo...@gmail.com on 11 Mar 2010 at 5:03

GoogleCodeExporter commented 9 years ago
I definitely have the Python headers, and compilation works just fine:

running build
running build_py
creating build-2.6
creating build-2.6/lib.linux-x86_64-2.6
creating build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/encoder.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/scanner.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/ordered_dict.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/tool.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/decoder.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/__init__.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
creating build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_encode_for_html.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_unicode.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_dump.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_fail.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_separators.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_decode.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_speedups.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_encode_basestring_ascii.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_pass1.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_pass2.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_pass3.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_indent.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_recursion.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_check_circular.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_default.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_float.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/__init__.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_scanstring.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_decimal.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
running build_ext
building 'simplejson._speedups' extension
creating build-2.6/temp.linux-x86_64-2.6
creating build-2.6/temp.linux-x86_64-2.6/simplejson
x86_64-pc-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -fPIC
-I/usr/include/python2.6 -c simplejson/_speedups.c -o
build-2.6/temp.linux-x86_64-2.6/simplejson/_speedups.o
x86_64-pc-linux-gnu-gcc -pthread -shared
build-2.6/temp.linux-x86_64-2.6/simplejson/_speedups.o -L/usr/lib64 -lpython2.6 
-o
build-2.6/lib.linux-x86_64-2.6/simplejson/_speedups.so

(I've now reproduced the failure outside the Portage environment, just 
unpacking the
tarball, then issuing the above build command, then the stated test command.)

Original comment by djc.ochtman on 11 Mar 2010 at 5:04

GoogleCodeExporter commented 9 years ago
Again you're not providing me with the exact commands that were run. You say 
"the above built command" but 
all you're providing is *output* from *some* build command, not which build 
command you ran or how you 
executed the tests.

If you were to run "python setup.py test" it would build the extension in-place 
and run all of the tests, which will 
all pass if _speedups.so was built in-place (essentially, via an implicit 
"python setup.py build_ext -i"). I have 
verified this myself on Python 2.6.4, amd64 with both UCS2 and UCS4 
configurations. I can confirm that those 
two tests fail if and only if _speedups.so could not be built (e.g. missing 
headers).

Original comment by bob.ippo...@gmail.com on 11 Mar 2010 at 5:19

GoogleCodeExporter commented 9 years ago
Okay, so here's a full transcript already:

djc@miles tmp $ tar xvzf /usr/portage/distfiles/simplejson-2.1.0.tar.gz 
simplejson-2.1.0/
simplejson-2.1.0/.hgignore
simplejson-2.1.0/._CHANGES.txt
simplejson-2.1.0/CHANGES.txt
simplejson-2.1.0/._conf.py
simplejson-2.1.0/conf.py
simplejson-2.1.0/docs/
simplejson-2.1.0/ez_setup.py
simplejson-2.1.0/._index.rst
simplejson-2.1.0/index.rst
simplejson-2.1.0/LICENSE.txt
simplejson-2.1.0/PKG-INFO
simplejson-2.1.0/scripts/
simplejson-2.1.0/setup.cfg
simplejson-2.1.0/setup.py
simplejson-2.1.0/simplejson/
simplejson-2.1.0/simplejson.egg-info/
simplejson-2.1.0/simplejson.egg-info/dependency_links.txt
simplejson-2.1.0/simplejson.egg-info/PKG-INFO
simplejson-2.1.0/simplejson.egg-info/SOURCES.txt
simplejson-2.1.0/simplejson.egg-info/top_level.txt
simplejson-2.1.0/simplejson.egg-info/zip-safe
simplejson-2.1.0/simplejson/.___init__.py
simplejson-2.1.0/simplejson/__init__.py
simplejson-2.1.0/simplejson/.__speedups.c
simplejson-2.1.0/simplejson/_speedups.c
simplejson-2.1.0/simplejson/._decoder.py
simplejson-2.1.0/simplejson/decoder.py
simplejson-2.1.0/simplejson/._encoder.py
simplejson-2.1.0/simplejson/encoder.py
simplejson-2.1.0/simplejson/._ordered_dict.py
simplejson-2.1.0/simplejson/ordered_dict.py
simplejson-2.1.0/simplejson/._scanner.py
simplejson-2.1.0/simplejson/scanner.py
simplejson-2.1.0/simplejson/tests/
simplejson-2.1.0/simplejson/._tool.py
simplejson-2.1.0/simplejson/tool.py
simplejson-2.1.0/simplejson/tests/.___init__.py
simplejson-2.1.0/simplejson/tests/__init__.py
simplejson-2.1.0/simplejson/tests/test_check_circular.py
simplejson-2.1.0/simplejson/tests/._test_decimal.py
simplejson-2.1.0/simplejson/tests/test_decimal.py
simplejson-2.1.0/simplejson/tests/._test_decode.py
simplejson-2.1.0/simplejson/tests/test_decode.py
simplejson-2.1.0/simplejson/tests/._test_default.py
simplejson-2.1.0/simplejson/tests/test_default.py
simplejson-2.1.0/simplejson/tests/._test_dump.py
simplejson-2.1.0/simplejson/tests/test_dump.py
simplejson-2.1.0/simplejson/tests/._test_encode_basestring_ascii.py
simplejson-2.1.0/simplejson/tests/test_encode_basestring_ascii.py
simplejson-2.1.0/simplejson/tests/test_encode_for_html.py
simplejson-2.1.0/simplejson/tests/test_fail.py
simplejson-2.1.0/simplejson/tests/._test_float.py
simplejson-2.1.0/simplejson/tests/test_float.py
simplejson-2.1.0/simplejson/tests/test_indent.py
simplejson-2.1.0/simplejson/tests/test_pass1.py
simplejson-2.1.0/simplejson/tests/test_pass2.py
simplejson-2.1.0/simplejson/tests/test_pass3.py
simplejson-2.1.0/simplejson/tests/test_recursion.py
simplejson-2.1.0/simplejson/tests/test_scanstring.py
simplejson-2.1.0/simplejson/tests/test_separators.py
simplejson-2.1.0/simplejson/tests/test_speedups.py
simplejson-2.1.0/simplejson/tests/._test_unicode.py
simplejson-2.1.0/simplejson/tests/test_unicode.py
simplejson-2.1.0/scripts/._make_docs.py
simplejson-2.1.0/scripts/make_docs.py
simplejson-2.1.0/docs/_sources/
simplejson-2.1.0/docs/_static/
simplejson-2.1.0/docs/genindex.html
simplejson-2.1.0/docs/._index.html
simplejson-2.1.0/docs/index.html
simplejson-2.1.0/docs/objects.inv
simplejson-2.1.0/docs/search.html
simplejson-2.1.0/docs/searchindex.js
simplejson-2.1.0/docs/searchindex.json
simplejson-2.1.0/docs/_static/contents.png
simplejson-2.1.0/docs/_static/default.css
simplejson-2.1.0/docs/_static/doctools.js
simplejson-2.1.0/docs/_static/file.png
simplejson-2.1.0/docs/_static/interface.js
simplejson-2.1.0/docs/_static/jquery.js
simplejson-2.1.0/docs/_static/minus.png
simplejson-2.1.0/docs/_static/navigation.png
simplejson-2.1.0/docs/_static/plus.png
simplejson-2.1.0/docs/_static/pygments.css
simplejson-2.1.0/docs/_static/rightsidebar.css
simplejson-2.1.0/docs/_static/searchtools.js
simplejson-2.1.0/docs/_static/sphinxdoc.css
simplejson-2.1.0/docs/_static/stickysidebar.css
simplejson-2.1.0/docs/_static/traditional.css
simplejson-2.1.0/docs/_sources/index.txt
djc@miles tmp $ cd simplejson-2.1.0/
djc@miles simplejson-2.1.0 $ python2.6 setup.py build -b build-2.6running build
running build_py
creating build-2.6
creating build-2.6/lib.linux-x86_64-2.6
creating build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/encoder.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/scanner.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/ordered_dict.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/tool.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/decoder.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
copying simplejson/__init__.py -> build-2.6/lib.linux-x86_64-2.6/simplejson
creating build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_encode_for_html.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_unicode.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_dump.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_fail.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_separators.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_decode.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_speedups.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_encode_basestring_ascii.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_pass1.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_pass2.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_pass3.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_indent.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_recursion.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_check_circular.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_default.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_float.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/__init__.py -> 
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_scanstring.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
copying simplejson/tests/test_decimal.py ->
build-2.6/lib.linux-x86_64-2.6/simplejson/tests
running build_ext
building 'simplejson._speedups' extension
creating build-2.6/temp.linux-x86_64-2.6
creating build-2.6/temp.linux-x86_64-2.6/simplejson
x86_64-pc-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -fPIC
-I/usr/include/python2.6 -c simplejson/_speedups.c -o
build-2.6/temp.linux-x86_64-2.6/simplejson/_speedups.o
x86_64-pc-linux-gnu-gcc -pthread -shared
build-2.6/temp.linux-x86_64-2.6/simplejson/_speedups.o -L/usr/lib64 -lpython2.6 
-o
build-2.6/lib.linux-x86_64-2.6/simplejson/_speedups.so
djc@miles simplejson-2.1.0 $ PYTHONPATH="build-${PYTHON_ABI}/lib" python
simplejson/tests/__init__.py
........................................E.......................................
......................E.....................
======================================================================
ERROR: test_make_scanner (simplejson.tests.test_speedups.TestDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/djc/tmp/simplejson-2.1.0/simplejson/tests/test_speedups.py", line 8, in
test_make_scanner
    self.assertRaises(AttributeError, scanner.c_make_scanner, 1)
  File "/usr/lib64/python2.6/unittest.py", line 336, in failUnlessRaises
    callableObj(*args, **kwargs)
TypeError: 'NoneType' object is not callable

======================================================================
ERROR: test_make_scanner (simplejson.tests.test_speedups.TestDecode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/djc/tmp/simplejson-2.1.0/simplejson/tests/test_speedups.py", line 8, in
test_make_scanner
    self.assertRaises(AttributeError, scanner.c_make_scanner, 1)
  File "/usr/lib64/python2.6/unittest.py", line 336, in failUnlessRaises
    callableObj(*args, **kwargs)
TypeError: 'NoneType' object is not callable

----------------------------------------------------------------------
Ran 124 tests in 2.592s

FAILED (errors=2)
djc@miles simplejson-2.1.0 $ 

So yes, your python setup.py test works, but it would be nice if there was a 
way of
running the tests that didn't require setuptools.

Original comment by djc.ochtman on 11 Mar 2010 at 5:24

GoogleCodeExporter commented 9 years ago
Well again, this is because you didn't build the extension in-place (python 
setup.py build_ext -i, which has no 
relation whatsoever to setuptools). Why do you expect that to work? You've 
built it in ./build-2.6/lib.linux-
x86_64-2.6/simplejson but you're running it from ./simplejson/

Either build it in-place and run the tests in-place (what setup.py test does), 
install it and run the tests on your 
installation, or build it somewhere else and run the tests *there*.

Original comment by bob.ippo...@gmail.com on 11 Mar 2010 at 8:06

GoogleCodeExporter commented 9 years ago
Well, I wasn't running the tests in place, I was running them in build-2.6/lib, 
but
apparently this doesn't work anymore because it's now in lib.linux-x86_64-2.6.

It used to work in 2.0.9, though, so I was confused about why it would break. 
Anyway,
sorry for the noise.

Original comment by djc.ochtman on 11 Mar 2010 at 8:14

GoogleCodeExporter commented 9 years ago
Actually no you were running it in-place with a strange/irrelevant PYTHONPATH. 
Not the same thing. The tests 
are designed to allow you to run them in-place if you execute it as a script.

When you did this with 2.0.9 you just didn't notice that you were testing only 
the pure python code path because 
there wasn't a speedup-specific test that had a bug in it.

Original comment by bob.ippo...@gmail.com on 11 Mar 2010 at 8:23