diff options
author | Tim Burke <tim.burke@gmail.com> | 2016-12-07 18:50:58 +0000 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2016-12-07 18:50:58 +0000 |
commit | 624f42281961a750ddbd082d702c22ab9bf0e5ec (patch) | |
tree | e9ad41d1d0cc619a6054f642808fee0f37d8f4ae | |
parent | ebaffcdfc14ba8d2aea2e39100d0e1e53d40aefa (diff) | |
download | pyeclib-624f42281961a750ddbd082d702c22ab9bf0e5ec.tar.gz |
Add tests for the availability of individual backends
These will either pass if the backend is available, or skip if it isn't.
What we definitely *don't* want is a situation where someone runs tests,
sees all passes with no skips, and assumes they must therefore have all
backends available.
Change-Id: I1d2c691d01f38d5e8f7bc9cf4ec4b9c50ace32b9
-rw-r--r-- | test/test_pyeclib_api.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_pyeclib_api.py b/test/test_pyeclib_api.py index b008894..75f4488 100644 --- a/test/test_pyeclib_api.py +++ b/test/test_pyeclib_api.py @@ -708,5 +708,21 @@ class TestPyECLibDriver(unittest.TestCase): (baseline_usage, new_usage)) +class TestBackendsEnabled(unittest.TestCase): + '''Based on TestPyECLibDriver.test_valid_algo above, but these tests + should *always* either pass or skip.''' + class __metaclass__(type): + def __new__(meta, cls_name, cls_bases, cls_dict): + for ec_type in ALL_EC_TYPES: + def dummy(self, ec_type=ec_type): + if ec_type not in VALID_EC_TYPES: + raise unittest.SkipTest + k, m = 10, 4 if ec_type == 'shss' else 5 + ECDriver(k=k, m=m, ec_type=ec_type) + dummy.__name__ = 'test_%s_available' % ec_type + cls_dict[dummy.__name__] = dummy + return type.__new__(meta, cls_name, cls_bases, cls_dict) + + if __name__ == '__main__': unittest.main() |