Skip to content
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

Test failures with Python 3.4 and enabled warnings #87

Closed
Arfrever opened this issue Feb 14, 2014 · 1 comment
Closed

Test failures with Python 3.4 and enabled warnings #87

Arfrever opened this issue Feb 14, 2014 · 1 comment

Comments

@Arfrever
Copy link

When warnings are enabled (using e.g. PYTHONWARNINGS="d" environmental variable), then 3 tests fail with Python 3.4.

$ PYTHONPATH="build/lib.linux-x86_64-3.4" PYTHONWARNINGS="d" python3.4 simplejson/tests/__init__.py
/usr/lib64/python3.4/imp.py:32: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  PendingDeprecationWarning)
................................../tmp/simplejson/simplejson/tests/test_errors.py:48: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(err.msg, e.msg)
/tmp/simplejson/simplejson/tests/test_errors.py:49: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(err.doc, e.doc)
/tmp/simplejson/simplejson/tests/test_errors.py:50: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(err.pos, e.pos)
/tmp/simplejson/simplejson/tests/test_errors.py:51: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(err.end, e.end)
............................................................FFF..............s
======================================================================
FAIL: test_infile_outfile (simplejson.tests.test_tool.TestTool)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/simplejson/simplejson/tests/test_tool.py", line 90, in test_infile_outfile
    self.runTool(args=[infile.name, outfile.name]),
  File "/tmp/simplejson/simplejson/tests/test_tool.py", line 64, in runTool
    self.assertEqual(strip_python_stderr(err), ''.encode())
AssertionError: b"/usr/lib64/python3.4/imp.py:32: PendingD[149 chars]ing)" != b''

======================================================================
FAIL: test_infile_stdout (simplejson.tests.test_tool.TestTool)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/simplejson/simplejson/tests/test_tool.py", line 78, in test_infile_stdout
    self.runTool(args=[infile.name]),
  File "/tmp/simplejson/simplejson/tests/test_tool.py", line 64, in runTool
    self.assertEqual(strip_python_stderr(err), ''.encode())
AssertionError: b"/usr/lib64/python3.4/imp.py:32: PendingD[149 chars]ing)" != b''

======================================================================
FAIL: test_stdin_stdout (simplejson.tests.test_tool.TestTool)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/simplejson/simplejson/tests/test_tool.py", line 70, in test_stdin_stdout
    self.runTool(data=self.data.encode()),
  File "/tmp/simplejson/simplejson/tests/test_tool.py", line 64, in runTool
    self.assertEqual(strip_python_stderr(err), ''.encode())
AssertionError: b"/usr/lib64/python3.4/imp.py:32: PendingD[149 chars]ing)" != b''

----------------------------------------------------------------------
Ran 112 tests in 3.650s

FAILED (failures=3, skipped=1)

Fix for failures:

--- simplejson/compat.py
+++ simplejson/compat.py
@@ -20,7 +20,10 @@

 else:
     PY3 = True
-    from imp import reload as reload_module
+    if sys.version_info[:2] >= (3, 4):
+        from importlib import reload as reload_module
+    else:
+        from imp import reload as reload_module
     import codecs
     def b(s):
         return codecs.latin_1_encode(s)[0]
@etrepum
Copy link
Member

etrepum commented Feb 15, 2014

Thanks, please re-open if this is not sufficient. I don't have Python 3.4 locally for testing. Will release a new version shortly after confirming that the suite passes in travis.

@etrepum etrepum closed this as completed Feb 15, 2014
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue May 4, 2014
Version 3.4.1 released 2014-04-30

* Fixed tests to run on Python 3.4

Version 3.4.0 released 2014-04-02

* Native setuptools support re-introduced
  simplejson/simplejson#92

Version 3.3.3 released 2014-02-14

* Improve test suite's Python 3.4 compatibility
  simplejson/simplejson#87
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jun 2, 2014
Version 3.4.1 released 2014-04-30

* Fixed tests to run on Python 3.4

Version 3.4.0 released 2014-04-02

* Native setuptools support re-introduced
  simplejson/simplejson#92

Version 3.3.3 released 2014-02-14

* Improve test suite's Python 3.4 compatibility
  simplejson/simplejson#87
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jun 11, 2014
Version 3.4.1 released 2014-04-30

* Fixed tests to run on Python 3.4

Version 3.4.0 released 2014-04-02

* Native setuptools support re-introduced
  simplejson/simplejson#92

Version 3.3.3 released 2014-02-14

* Improve test suite's Python 3.4 compatibility
  simplejson/simplejson#87
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Oct 11, 2014
Version 3.4.1 released 2014-04-30

* Fixed tests to run on Python 3.4

Version 3.4.0 released 2014-04-02

* Native setuptools support re-introduced
  simplejson/simplejson#92

Version 3.3.3 released 2014-02-14

* Improve test suite's Python 3.4 compatibility
  simplejson/simplejson#87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants