diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-02-10 20:32:32 +0000 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-02-10 20:32:32 +0000 |
commit | a4a6702758cf60ecb8742d78e576733dbbdbb9a0 (patch) | |
tree | b5f23eff4f9c7e87fe2b09cdbe1d1b38aa518929 /tests/unittests/helpers.py | |
parent | 888db3e6bb9076973d2f6a73e0c4f691caa89603 (diff) | |
download | vyos-cloud-init-a4a6702758cf60ecb8742d78e576733dbbdbb9a0.tar.gz vyos-cloud-init-a4a6702758cf60ecb8742d78e576733dbbdbb9a0.zip |
make bddeb work with python3 or python2
painful, and not perfect, but at this point the output builds
on a vivid system python2 (bddeb --python2) or python3.
* remove use of cheetah by bddeb in favor of builtin renderer
* add '--python2' flag to bddeb and knowledge of python 2 and python3
package names.
* read-dependencies can now read test-requirements also.
* differenciate from build-requirements and runtime requirements.
Diffstat (limited to 'tests/unittests/helpers.py')
-rw-r--r-- | tests/unittests/helpers.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index f92e7ac2..6b9394b3 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import os import sys import shutil @@ -275,3 +277,17 @@ def populate_dir(path, files): with open(os.path.join(path, name), "w") as fp: fp.write(content) fp.close() + +try: + skipIf = unittest.skipIf +except AttributeError: + # Python 2.6. Doesn't have to be high fidelity. + def skipIf(condition, reason): + def decorator(func): + def wrapper(*args, **kws): + if condition: + return func(*args, **kws) + else: + print(reason, file=sys.stderr) + return wrapper + return decorator |