[New-bugs-announce] [issue27425] Tests fail because of git's newline preferences on Windows

Emanuel Barry report at bugs.python.org
Thu Jun 30 13:16:29 EDT 2016


New submission from Emanuel Barry:

Specifically, test_random and test_sax both fail because of git's newline preferences. Mine is set to convert \r\n to \n on push and the other way around on pull. Relevant output:

test_random:

....EException ignored in: <_io.FileIO name='E:\\GitHub\\cpython\\lib\\test\\randv2_32.pck' mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.BufferedReader name='E:\\GitHub\\cpython\\lib\\test\\randv2_32.pck'>
...........................EException ignored in: <_io.FileIO name='E:\\GitHub\\cpython\\lib\\test\\randv2_32.pck' mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.BufferedReader name='E:\\GitHub\\cpython\\lib\\test\\randv2_32.pck'>
............................
======================================================================
ERROR: test_bug_1727780 (__main__.MersenneTwister_TestBasicOps)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_random.py", line 178, in test_bug_1727780
    r = pickle.load(f)
ImportError: No module named 'random\r'

======================================================================
ERROR: test_bug_1727780 (__main__.SystemRandom_TestBasicOps)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_random.py", line 178, in test_bug_1727780
    r = pickle.load(f)
ImportError: No module named 'random\r'

----------------------------------------------------------------------
Ran 61 tests in 1.480s

FAILED (errors=2)

test_sax:

(Passing tests omitted)

======================================================================
FAIL: test_expat_binary_file (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 836, in test_expat_binary_file
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

======================================================================
FAIL: test_expat_binary_file_bytes_name (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 874, in test_expat_binary_file_bytes_name
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

======================================================================
FAIL: test_expat_binary_file_int_name (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 886, in test_expat_binary_file_int_name
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

======================================================================
FAIL: test_expat_binary_file_nonascii (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 862, in test_expat_binary_file_nonascii
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

======================================================================
FAIL: test_expat_inpsource_byte_stream (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 1053, in test_expat_inpsource_byte_stream
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

======================================================================
FAIL: test_expat_inpsource_character_stream (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 1066, in test_expat_inpsource_character_stream
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

======================================================================
FAIL: test_expat_inpsource_filename (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 1015, in test_expat_inpsource_filename
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

======================================================================
FAIL: test_expat_inpsource_sysid (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 1025, in test_expat_inpsource_sysid
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

======================================================================
FAIL: test_expat_inpsource_sysid_nonascii (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 1040, in test_expat_inpsou
rce_sysid_nonascii
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

======================================================================
FAIL: test_expat_text_file (__main__.ExpatReaderTest)
----------------------------------------------------------------------
Traceback (most recent call last):  File "E:\GitHub\cpython\lib\test\test_sax.py", line 847, in test_expat_text_fi
le
    self.assertEqual(result.getvalue(), xml_test_out)
AssertionError: b'<?x[36 chars]1"?>\n<HTML xmlns:pp="http://www.isogen.com/pa[1508 chars]TML>' != b'<?x[36 chars]1"?>\r\n<HTML xmlns:pp="http://www.isogen.com/[1736 chars]TML>'

----------------------------------------------------------------------
Ran 171 tests in 0.200s

FAILED (failures=10)
Traceback (most recent call last):
  File "E:\GitHub\cpython\lib\runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\GitHub\cpython\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 1261, in <module>
    test_main()
  File "E:\GitHub\cpython\lib\test\test_sax.py", line 1258, in test_main
    XmlReaderTest)
  File "E:\GitHub\cpython\lib\test\support\__init__.py", line 1837, in run_unittest
    _run_suite(suite)
  File "E:\GitHub\cpython\lib\test\support\__init__.py", line 1812, in _run_suite
    raise TestFailed(err)
test.support.TestFailed: multiple errors occurred

----------
components: Tests
messages: 269604
nosy: ebarry
priority: normal
severity: normal
status: open
title: Tests fail because of git's newline preferences on Windows
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27425>
_______________________________________


More information about the New-bugs-announce mailing list