nose icon indicating copy to clipboard operation
nose copied to clipboard

Nose monkeypatches "stdout" and does not provide "encoding"

Open throwable-one opened this issue 7 years ago • 1 comments

On Windows. pip install win_unicode_console

Run following code with nosetests

from unittest import TestCase

import win_unicode_console
win_unicode_console.enable()

def test_test():
    pass

class FooTest(TestCase):
    def test_test(self):
        pass

Result:

Traceback (most recent call last):
  File "c:\python27\lib\site-packages\nose\loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "c:\python27\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "c:\python27\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "C:\temp\untitled11\test_test.py", line 4, in <module>
    win_unicode_console.enable()
  File "c:\python27\lib\site-packages\win_unicode_console\__init__.py", line 31, in enable
    readline_hook.enable(use_pyreadline=use_pyreadline)
  File "c:\python27\lib\site-packages\win_unicode_console\readline_hook.py", line 134, in enable
    check_encodings()
  File "c:\python27\lib\site-packages\win_unicode_console\readline_hook.py", line 50, in check_encodings
    if sys.stdin.encoding != sys.stdout.encoding:
AttributeError: StringIO instance has no attribute 'encoding'

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

throwable-one avatar Nov 16 '17 22:11 throwable-one

Nose bug https://github.com/nose-devs/nose/issues/1065

throwable-one avatar Nov 16 '17 23:11 throwable-one