cdown/srt

srt_tools may use wrong line ending on Windows

cdown opened this issue · 1 comments

cdown commented

When moving Appveyor to run more Python versions, this came up: https://ci.appveyor.com/project/cdown/srt/builds/29538330/job/p6uduspto7yl8wcs

Specifically, failures of the form:

======================================================================
FAIL: srt_tools.tests.test_srt_tools.test_tools_support(['python', 'srt_tools/srt-normalise'], False, {})
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\projects\srt\.tox\py37\lib\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "c:\projects\srt\.tox\py37\lib\site-packages\parameterized\parameterized.py", line 373, in <lambda>
    nose_func = wraps(func)(lambda *args: func(*args[:-1], **args[-1]))
  File "C:\projects\srt\srt_tools\tests\test_srt_tools.py", line 125, in test_tools_support
    assert_supports_all_io_methods(args, exclude_output, exclude_stdin)
  File "C:\projects\srt\srt_tools\tests\test_srt_tools.py", line 88, in assert_supports_all_io_methods
    assert_true(len(set(outputs)) == 1, repr(outputs))
AssertionError: False is not true : ['1\n00:00:27,000 --> 00:00:30,730\nascii\n\n2\n00:00:31,500 --> 00:00:34,100\noh look\n\n3\n00:00:34,100 --> 00:00:36,570\nascii everywhere\n\n', '1\r\n00:00:27,000 --> 00:00:30,730\r\nascii\r\n\r\n2\r\n00:00:31,500 --> 00:00:34,100\r\noh look\r\n\r\n3\r\n00:00:34,100 --> 00:00:36,570\r\nascii everywhere\r\n\r\n']

The input file always has \n, so I suppose this should be a universal newlines issue on output. Interesting that this wasn't detected before by the existing Python 3 Windows test...

This could also be some issue when we're doing subprocess.check_output, so it may or may not be actually real outside of tests.

cdown commented

Fixed in 7d4a3ed