Closed Hellowlol closed 7 years ago
Thank you. There are questions though.
[...] _create still fails [...]
So total_size
is not 23
I expect? Maybe a carriage-return related issue?
No, the length is 5. Ill add the traceback later. I cant remember what was wrong
Ill add the traceback later.
OK, will wait.
============================= test session starts =============================
platform win32 -- Python 2.7.10, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 -- C:\Python27\python.exe
cachedir: .cache
rootdir: C:\Users\steffen\Documents\GitHub\torrentool, inifile:
plugins: cov-2.2.1, mock-1.1, xdist-1.14
collecting ... collected 16 items
tests/test_bencode.py::test_read_file_dir PASSED
tests/test_bencode.py::test_read_file PASSED
tests/test_bencode.py::test_decode_simple PASSED
tests/test_bencode.py::test_decode_errors PASSED
tests/test_bencode.py::test_encode_simple PASSED
tests/test_bencode.py::test_encode_complex PASSED
tests/test_bencode.py::test_encode_errors PASSED
tests/test_bencode.py::test_encode_error_long PASSED
tests/test_etc.py::test_get_app_version PASSED
tests/test_torrent.py::test_create FAILED
tests/test_torrent.py::test_getters_simple PASSED
tests/test_torrent.py::test_getters_dir PASSED
tests/test_torrent.py::test_setters PASSED
tests/test_torrent.py::test_from_string PASSED
tests/test_torrent.py::test_to_file PASSED
tests/test_torrent.py::test_str PASSED
================================== FAILURES ===================================
_________________________________ test_create _________________________________
def test_create():
fp = join(CURRENT_DIR, 'torrtest', 'root.txt')
t = Torrent.create_from(fp)
t.private = True
> assert t._struct['info'] == STRUCT_TORRENT_SIMPLE['info']
E assert {'length': 5L..."M7\xc3', ...} == OrderedDict([(...private', 1)])
E Common items:
E {'name': 'root.txt', 'piece length': 32768, 'private': 1}
E Differing items:
E {'length': 5L} != {'length': 4}
E {'pieces': '\x02P\xa7\xb0\x95\xbcj\x96\x9a\xdb\xe2]\xe1M#\xc4"M7\xc3'} != {'pieces': '\xa8\xfd\xc2\x05\xa9\xf1\x9c\xc1\xc7Pz`\xc4\xf0\x1b\x13\xd1\x1d\x7f\xd0'}
E Full diff:
E + OrderedDict([('length', 4), ('name', 'root.txt'), ('piece length', 32768), ('pieces', '\xa8\xfd\xc2\x05\xa9\xf1\x9c\xc1\xc7Pz`\xc4\xf0\x1b\x13\xd1\x1d\x7f\xd0'), ('private', 1)])
E - {'length': 5L,
E - 'name': 'root.txt',
E - 'piece length': 32768,
E - 'pieces': '\x02P\xa7\xb0\x95\xbcj\x96\x9a\xdb\xe2]\xe1M#\xc4"M7\xc3',
E - 'private': 1}
tests\test_torrent.py:20: AssertionError
===================== 1 failed, 15 passed in 0.11 seconds =====================
============================= test session starts =============================
platform win32 -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 -- C:\Users\steffen\AppData\Local\Programs\Python\Python35\python.exe
cachedir: .cache
rootdir: C:\Users\steffen\Documents\GitHub\torrentool, inifile:
plugins: cov-2.2.1, mock-1.1, xdist-1.14
collecting ... collected 16 items
tests/test_bencode.py::test_read_file_dir PASSED
tests/test_bencode.py::test_read_file PASSED
tests/test_bencode.py::test_decode_simple PASSED
tests/test_bencode.py::test_decode_errors PASSED
tests/test_bencode.py::test_encode_simple PASSED
tests/test_bencode.py::test_encode_complex PASSED
tests/test_bencode.py::test_encode_errors PASSED
tests/test_bencode.py::test_encode_error_long xfail
tests/test_etc.py::test_get_app_version PASSED
tests/test_torrent.py::test_create FAILED
tests/test_torrent.py::test_getters_simple PASSED
tests/test_torrent.py::test_getters_dir PASSED
tests/test_torrent.py::test_setters PASSED
tests/test_torrent.py::test_from_string PASSED
tests/test_torrent.py::test_to_file PASSED
tests/test_torrent.py::test_str PASSED
================================== FAILURES ===================================
_________________________________ test_create _________________________________
def test_create():
fp = join(CURRENT_DIR, 'torrtest', 'root.txt')
t = Torrent.create_from(fp)
t.private = True
> assert t._struct['info'] == STRUCT_TORRENT_SIMPLE['info']
E assert {'length': 5,..."M7\xc3', ...} == OrderedDict([(...private', 1)])
E Common items:
E {'name': 'root.txt', 'piece length': 32768, 'private': 1}
E Differing items:
E {'pieces': b'\x02P\xa7\xb0\x95\xbcj\x96\x9a\xdb\xe2]\xe1M#\xc4"M7\xc3'} != {'pieces': b'\xa8\xfd\xc2\x05\xa9\xf1\x9c\xc1\xc7Pz`\xc4\xf0\x1b\x13\xd1\x1d\x7f\xd0'}
E {'length': 5} != {'length': 4}
E Full diff:
E - {'length': 5,
E - 'name': 'root.txt',
E - 'piece length': 32768,
E - 'pieces': b'\x02P\xa7\xb0\x95\xbcj\x96\x9a\xdb\xe2]\xe1M#\xc4"M7\xc3',
E - 'private': 1}
E + OrderedDict([('length', 4),
E + ('name', 'root.txt'),
E + ('piece length', 32768),
E + ('pieces',
E + b'\xa8\xfd\xc2\x05\xa9\xf1\x9c\xc1\xc7Pz`\xc4\xf0\x1b\x13'
E + b'\xd1\x1d\x7f\xd0'),
E + ('private', 1)])
tests\test_torrent.py:20: AssertionError
=============== 1 failed, 14 passed, 1 xfailed in 0.25 seconds ================
Since there are 4 bytes 31 32 33 0A
originally, I suppose that is indeed a carriage return issue.
That maybe related to you Git core.autocrlf
setting.
We can .gitattributes
file with to have the same test results on both systems.
tests/torrtest/*.txt text eol=lf
Merged. Thank you.
…_create still fails because length is 5 on my computer and 4 in the data. Dunno whats correct