I wonder why I got this error when running testUpdateHostsFile.py
updateHostsFile.py run just fine
I already installed the dependencies with pip. My python version is 3.8.2
PS C:\Users\blue\Utility\hosts-master> python .\testUpdateHostsFile.py
..............................................................................................F.FF............
======================================================================
FAIL: test_add_fields (__main__.TestUpdateReadmeData)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".\testUpdateHostsFile.py", line 1136, in test_add_fields
self.assertEqual(actual, expected)
AssertionError: {'foo': 'bar', 'base': {'location': 'foo/',[34 chars]ts'}} != {'base': {'location': 'foo\\', 'sourcesdata[35 chars]bar'}
- {'base': {'entries': 5, 'location': 'foo/', 'sourcesdata': 'hosts'},
? ^
+ {'base': {'entries': 5, 'location': 'foo\\', 'sourcesdata': 'hosts'},
? ^^
'foo': 'bar'}
======================================================================
FAIL: test_modify_fields (__main__.TestUpdateReadmeData)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".\testUpdateHostsFile.py", line 1153, in test_modify_fields
self.assertEqual(actual, expected)
AssertionError: {'base': {'location': 'foo/', 'entries': 5, 'sourcesdata': 'hosts'}} != {'base': {'location': 'foo\\', 'sourcesdata': 'hosts', 'entries': 5}}
- {'base': {'entries': 5, 'location': 'foo/', 'sourcesdata': 'hosts'}}
? ^
+ {'base': {'entries': 5, 'location': 'foo\\', 'sourcesdata': 'hosts'}}
? ^^
======================================================================
FAIL: test_set_extensions (__main__.TestUpdateReadmeData)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".\testUpdateHostsFile.py", line 1177, in test_set_extensions
self.assertEqual(actual, expected)
AssertionError: {'com-org': {'location': 'foo/', 'entries': 5, 'sourcesdata': 'hosts'}} != {'com-org': {'location': 'foo\\', 'sourcesdata': 'hosts', 'entries': 5}}
- {'com-org': {'entries': 5, 'location': 'foo/', 'sourcesdata': 'hosts'}}
? ^
+ {'com-org': {'entries': 5, 'location': 'foo\\', 'sourcesdata': 'hosts'}}
? ^^
----------------------------------------------------------------------
Ran 110 tests in 0.118s
FAILED (failures=3)
I guess tests only work on nix and don't handle the Windows separator.
Thanks @onmyouji, good catch.
If this is fixed we can try running CI on Windows too (maybe just one Python version, though). I guess it would make things consistent :)
Most helpful comment
If this is fixed we can try running CI on Windows too (maybe just one Python version, though). I guess it would make things consistent :)