Skip to content

Instantly share code, notes, and snippets.

@x746e
Created March 9, 2017 16:10
Show Gist options
  • Save x746e/79f8b4cf2db4015e738ae336a461e979 to your computer and use it in GitHub Desktop.
Save x746e/79f8b4cf2db4015e738ae336a461e979 to your computer and use it in GitHub Desktop.
% python setup.py test
running pytest
running egg_info
writing top-level names to xdis.egg-info/top_level.txt
writing xdis.egg-info/PKG-INFO
writing dependency_links to xdis.egg-info/dependency_links.txt
reading manifest file 'xdis.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'xdis.egg-info/SOURCES.txt'
running build_ext
======================================================================== test session starts =========================================================================
platform linux2 -- Python 2.7.12[pypy-5.6.0-final], pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /usr/local/google/home/ksp/src/python-xdis, inifile:
collected 28 items
pytest/test_bytecode.py .
pytest/test_disasm.py ...
pytest/test_load_file.py F
pytest/test_std.py ....F.FF...F...
test_unit/test_dis.py ....
test_unit/test_load.py .
test_unit/test_magic.py .
test_unit/test_marsh.py .
test_unit/test_opcode.py .
============================================================================== FAILURES ==============================================================================
___________________________________________________________________________ test_load_file ___________________________________________________________________________
@pytest.mark.skipif(sys.version_info >= (3,5),
reason="Doesn't work on 3.5 and later")
def test_load_file():
co = load_file(__file__)
obj_path = check_object_path(__file__)
(version, timestamp, magic_int, co2, pypy,
source_size) = load_module(obj_path)
if (3,0) <= sys.version_info:
statinfo = os.stat(__file__)
assert statinfo.st_size == source_size
else:
assert source_size is None
> assert co == co2
E assert <code object <module>, file '/usr/local/google/home/ksp/src/python-xdis/pytest/test_load_file.py', line 1> == <code object <module>, file '/usr/local/google/home/ksp/src/python-xdis/pytest/test_load_file.py', line 1>
test_load_file.py:17: AssertionError
_________________________________________________________________________ test_bytecode_info _________________________________________________________________________
bytecode_fixture = Bytecode('a = 10')
def test_bytecode_info(bytecode_fixture):
> assert bytecode_fixture.info() == EXPECTED_CODE_INFO
E assert '# Method Nam...s:\n# 0: a' == '# Method Name...s:\n# 0: a'
E Skipping 153 identical leading characters in diff, use -v to show
E - 0x00000000 (0x0)
E + 0x00000040 (NOFREE)
E # Constants:
E # 0: 10
E # 1: None
E # Names:
E # 0: a
test_std.py:87: AssertionError
___________________________________________________________________________ test_code_info ___________________________________________________________________________
def test_code_info():
> assert dis.code_info(TEST_SOURCE_CODE) == EXPECTED_CODE_INFO
E assert '# Method Nam...s:\n# 0: a' == '# Method Name...s:\n# 0: a'
E Skipping 153 identical leading characters in diff, use -v to show
E - 0x00000000 (0x0)
E + 0x00000040 (NOFREE)
E # Constants:
E # 0: 10
E # 1: None
E # Names:
E # 0: a
test_std.py:95: AssertionError
___________________________________________________________________________ test_show_code ___________________________________________________________________________
stream_fixture = <StringIO.StringIO instance at 0x00000000032389e0>
def test_show_code(stream_fixture):
dis.show_code(TEST_SOURCE_CODE, file=stream_fixture)
actual = stream_fixture.getvalue()
> assert actual == EXPECTED_CODE_INFO + '\n'
E assert '# Method Nam...\n# 0: a\n' == '# Method Name...\n# 0: a\n'
E Skipping 153 identical leading characters in diff, use -v to show
E - 0x00000000 (0x0)
E + 0x00000040 (NOFREE)
E # Constants:
E # 0: 10
E # 1: None
E # Names:
E # 0: a
test_std.py:101: AssertionError
__________________________________________________________________________ test_disassemble __________________________________________________________________________
stream_fixture = <StringIO.StringIO instance at 0x000000000325a460>
def test_disassemble(stream_fixture):
dis.disassemble(TEST_CODE, file=stream_fixture)
actual = stream_fixture.getvalue()
expected = EXPECTED_CODE_INFO + '\n' + EXPECTED_DIS + '\n'
> assert actual == expected
E assert '# Method Nam...URN_VALUE\n\n' == '# Method Name...URN_VALUE\n\n'
E Skipping 153 identical leading characters in diff, use -v to show
E - 0x00000000 (0x0)
E + 0x00000040 (NOFREE)
E # Constants:
E # 0: 10
E # 1: None
E # Names:
E # 0: a
E 1 0 LOAD_CONST 0 (10)
E 3 STORE_NAME 0 (a)
E 6 LOAD_CONST 1 (None)
E 9 RETURN_VALUE
test_std.py:125: AssertionError
================================================================ 5 failed, 23 passed in 0.51 seconds =================================================================
% python --version
Python 2.7.12 (aff251e54385, Nov 09 2016, 18:02:49)
[PyPy 5.6.0 with GCC 4.8.2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment