Mercurial > hgsubversion
comparison tests/test_util.py @ 720:a19a208c085b
test_util: new requiresmodule decorator for tests that require a feature
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 04 Oct 2010 23:03:12 -0500 |
parents | ae52a3b30cfb |
children | e830b592917b |
comparison
equal
deleted
inserted
replaced
719:ae52a3b30cfb | 720:a19a208c085b |
---|---|
102 def _makeskip(name, message): | 102 def _makeskip(name, message): |
103 def skip(*args, **kwargs): | 103 def skip(*args, **kwargs): |
104 raise SkipTest(message) | 104 raise SkipTest(message) |
105 skip.__name__ = name | 105 skip.__name__ = name |
106 return skip | 106 return skip |
107 | |
108 | |
109 def requiresmodule(mod): | |
110 """Skip a test if the specified module is not None.""" | |
111 def decorator(fn): | |
112 if mod is not None: | |
113 return fn | |
114 return _makeskip(fn.__name__, 'missing required feature') | |
115 return decorator | |
107 | 116 |
108 | 117 |
109 def requiresoption(option): | 118 def requiresoption(option): |
110 '''Skip a test if commands.clone does not take the specified option.''' | 119 '''Skip a test if commands.clone does not take the specified option.''' |
111 def decorator(fn): | 120 def decorator(fn): |