Skip to content

Commit 3644198

Browse files
Merge pull request #81 from imbillow/ci
FIx #80 and fix compatibility with python2.7
2 parents d8fab1d + 36e1397 commit 3644198

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed

.github/workflows/main.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,9 @@ jobs:
3333
- name: Run tests
3434
shell: bash
3535
run: |
36+
set -e
3637
find . -name \*.py -exec pycodestyle --ignore=E501 {} \;
37-
find . -name test\*py -exec py.test {} -v --cov=idb \;
38+
for f in $(find . -name test\*py)
39+
do
40+
py.test -v --cov=idb $f
41+
done

idb/analysis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ def procName(self):
829829
def vsParse(self, sbytes, offset=0, fast=False):
830830
self.sbytes = sbytes
831831
self.len_sbytes = len(sbytes)
832-
return super().vsParse(sbytes, offset, fast)
832+
return vstruct.VStruct.vsParse(self, sbytes, offset, fast)
833833

834834

835835
Root = Analysis(

tests/conftest.py

+18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1+
import pytest
2+
3+
14
def pytest_addoption(parser):
25
parser.addoption("--runslow", action="store_true", help="run slow tests")
36

47
parser.addoption("--rundebug", action="store_true", help="run debug tests")
8+
9+
10+
# from https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option
11+
def pytest_configure(config):
12+
config.addinivalue_line("markers", "slow: mark test as slow to run")
13+
14+
15+
def pytest_collection_modifyitems(config, items):
16+
if config.getoption("--runslow"):
17+
# --runslow given in cli: do not skip slow tests
18+
return
19+
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
20+
for item in items:
21+
if "slow" in item.keywords:
22+
item.add_marker(skip_slow)

tests/test_idaapi.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
import idb
77

8-
slow = pytest.mark.skipif(not runslow, reason="need --runslow option to run")
9-
108

119
def pluck(prop, s):
1210
"""
@@ -545,7 +543,7 @@ def test_function_names(kernel32_idb, version, bitness, expected):
545543
_ = api.idc.GetFunctionName(0x689018E5)
546544

547545

548-
@slow
546+
@pytest.mark.slow
549547
@kern32_test()
550548
def test_all_function_names(kernel32_idb, version, bitness, expected):
551549
api = idb.IDAPython(kernel32_idb)
@@ -573,7 +571,7 @@ def test_comments(kernel32_idb, version, bitness, expected):
573571
assert api.idc.GetCommentEx(0x689023B4, True) == "jumptable 6892FF97 default case"
574572

575573

576-
@slow
574+
@pytest.mark.slow
577575
@kern32_test(
578576
[
579577
(695, 32, (13369, 283)),

tests/test_idb.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import idb.fileformat
77
import idb.netnode
88

9-
slow = pytest.mark.skipif(not runslow, reason="need --runslow option to run")
10-
119

1210
def h2b(somehex):
1311
"""
@@ -449,7 +447,7 @@ def test_cursor_complex_leaf_prev(kernel32_idb, version, bitness, expected):
449447
assert b2h(cursor.key) == "2eff00002253689bea8e"
450448

451449

452-
@slow
450+
@pytest.mark.slow
453451
@kern32_test()
454452
def test_cursor_enum_all_asc(kernel32_idb, version, bitness, expected):
455453
minkey = kernel32_idb.id0.get_min().key
@@ -465,7 +463,7 @@ def test_cursor_enum_all_asc(kernel32_idb, version, bitness, expected):
465463
assert kernel32_idb.id0.record_count == count
466464

467465

468-
@slow
466+
@pytest.mark.slow
469467
@kern32_test()
470468
def test_cursor_enum_all_desc(kernel32_idb, version, bitness, expected):
471469
maxkey = kernel32_idb.id0.get_max().key

0 commit comments

Comments
 (0)