Skip to content

Commit 6ead79c

Browse files
committed
Use nose.plugins.attrib to mark some tests as slow
Slow tests can be skipped with nosetests bpython/test -A "speed != 'slow'" Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent bed1c27 commit 6ead79c

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

bpython/test/test_crashers.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919
except ImportError:
2020
reactor = None
2121

22+
try:
23+
import urwid
24+
have_urwid = True
25+
except ImportError:
26+
have_urwid = False
27+
28+
try:
29+
from nose.plugins.attrib import attr
30+
except ImportError:
31+
def attr(func, *args, **kwargs):
32+
return func
33+
2234
TEST_CONFIG = os.path.join(os.path.dirname(__file__), "test.config")
2335

2436
def set_win_size(fd, rows, columns):
@@ -103,13 +115,15 @@ def spam(a, (b, c)):
103115
def check_no_traceback(self, data):
104116
self.assertNotIn("Traceback", data)
105117

106-
if reactor is not None:
107-
class CursesCrashersTest(TrialTestCase, CrashersTest):
108-
backend = "cli"
118+
@unittest.skipIf(reactor is None, "twisted is not available")
119+
class CursesCrashersTest(TrialTestCase, CrashersTest):
120+
backend = "cli"
109121

110-
@unittest.skip("take 6 seconds, and Simon says we can skip them")
111-
class UrwidCrashersTest(TrialTestCase, CrashersTest):
112-
backend = "urwid"
122+
@attr(speed='slow')
123+
@unittest.skipIf(not have_urwid, "urwid is not available")
124+
@unittest.skipIf(reactor is None, "twisted is not available")
125+
class UrwidCrashersTest(TrialTestCase, CrashersTest):
126+
backend = "urwid"
113127

114128
if __name__ == "__main__":
115129
unittest.main()

0 commit comments

Comments
 (0)