Test fails at test_cli_list_converters (tests.test_cli.CliTestCase) and test_cli_list_langs (tests.test_cli.CliTestCase)
======================================================================
FAIL: test_cli_list_converters (tests.test_cli.CliTestCase)
You should be able to list all available converters
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\users\ali\projects\tmp\num2words\tests\test_cli.py", line 74, in test_cli_list_converters
self.assertEqual(
AssertionError: Lists differ: ['cardinal', 'currency', 'ordinal', 'ordinal_num', 'year'] != ['cardinal\n\ncurrency\n\nordinal\n\nordinal_num\n\nyear']
First differing element 0:
'cardinal'
'cardinal\n\ncurrency\n\nordinal\n\nordinal_num\n\nyear'
First list contains 4 additional elements.
First extra element 1:
'currency'
- ['cardinal', 'currency', 'ordinal', 'ordinal_num', 'year']
+ ['cardinal\n\ncurrency\n\nordinal\n\nordinal_num\n\nyear']
======================================================================
FAIL: test_cli_list_langs (tests.test_cli.CliTestCase)
You should be able to list all availabe languages
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\users\ali\projects\tmp\num2words\tests\test_cli.py", line 60, in test_cli_list_langs
self.assertEqual(
AssertionError: Lists differ: ['ar', 'cz', 'de', 'dk', 'en', 'en_IN', 'es',[214 chars]'vi'] != ['ar\n\ncz\n\nde\n\ndk\n\nen\n\nen_IN\n\nes\n[214 chars]nvi']
First differing element 0:
'ar'
'ar\n\ncz\n\nde\n\ndk\n\nen\n\nen_IN\n\nes\n[213 chars]\nvi'
First list contains 39 additional elements.
First extra element 1:
'cz'
Diff is 1938 characters long. Set self.maxDiff to None to see it.
----------------------------------------------------------------------
Steps to reproduce
Platform: Windows 10, version 2004, OS build 19041.1052; Python 3.9.5
Setup Virtual Environment python -m venv .venv
Install python .\setup.py install
Run Tests python .\setup.py test
Remarks
The error seems to be occurring because delegator.py returns output with line termination "\n\n", while the test suite expects the line termination to be os.linesep (which is "\r\n" on windows). According to subprocess documentation "For stdout and stderr, all line endings in the output will be converted to '\n'." irrespective of platform, this would suggest that the use of os.linesep is unnecessary to split the output. But the issue is that on windows the lines are terminated by "\n\n" and not just "\n" as in other platforms. This might be bug in subprocess itself.
Expected Behaviour
Tests complete successfully.
Actual Behaviour
Test fails at
test_cli_list_converters (tests.test_cli.CliTestCase)
andtest_cli_list_langs (tests.test_cli.CliTestCase)
Steps to reproduce
python -m venv .venv
python .\setup.py install
python .\setup.py test
Remarks
The error seems to be occurring because
delegator.py
returns output with line termination"\n\n"
, while the test suite expects the line termination to beos.linesep
(which is"\r\n"
on windows). According to subprocess documentation "For stdout and stderr, all line endings in the output will be converted to'\n'
." irrespective of platform, this would suggest that the use ofos.linesep
is unnecessary to split the output. But the issue is that on windows the lines are terminated by "\n\n" and not just "\n" as in other platforms. This might be bug in subprocess itself.