Skip to content

Getdefaultencoding test error with sympy 0.7.1_git #2035

@jenshnielsen

Description

@jenshnielsen

I'm seeing the following test errors when a resent sympy git version is installed. Removing sympy from the system
solves the problem. I don't think it's an IPython bug but since it was quite hard to track down I will report it anyway.

======================================================================
ERROR: test suite for <module 'IPython.core.tests.test_compilerop' from '/usr/local/lib/python2.7/dist-packages/IPython/core/tests/test_compilerop.pyc'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/dist-packages/nose/util.py", line 478, in try_run
    return func()
  File "/usr/local/lib/python2.7/dist-packages/IPython/core/tests/test_compilerop.py", line 55, in setUp
    nt.assert_equal(sys.getdefaultencoding(), "utf-8" if py3compat.PY3 else "ascii")
AssertionError: 'utf-8' != 'ascii'

======================================================================
ERROR: test suite for <module 'IPython.core.tests.test_history' from '/usr/local/lib/python2.7/dist-packages/IPython/core/tests/test_history.pyc'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/dist-packages/nose/util.py", line 478, in try_run
    return func()
  File "/usr/local/lib/python2.7/dist-packages/IPython/core/tests/test_history.py", line 26, in setUp
    nt.assert_equal(sys.getdefaultencoding(), "utf-8" if py3compat.PY3 else "ascii")
AssertionError: 'utf-8' != 'ascii'

It appears that the import of sympy modifies the sys default encoding from ascii to utf-8.
This happens when the test suit is run as it checks for sympy in IPython.testing.decorators.

Steps to reproduce:
Install sympy master
sys.getdefaultencoding is ascii
import sympy
sys.getdefaultencoding is now utf-8

Note that this doesn't happen with sympy0.7.1 and also not with older dev. versions of sympy
(more than a few month I believe but I haven't bisected it. )

Observed on Ubuntu 12.04 with ipython 13 beta

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions