Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

Commit 36e1397

Browse files
committed
Fix @slow deprecation error
1 parent c5d2cc1 commit 36e1397

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

tests/conftest.py

Lines changed: 18 additions & 0 deletions
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

Lines changed: 2 additions & 4 deletions
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

Lines changed: 2 additions & 4 deletions
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)