Merge "Add --libpath argv option to fix unittest failure"
diff --git a/tempest/lib/cmd/check_uuid.py b/tempest/lib/cmd/check_uuid.py
index 0ae11ca..466222d 100755
--- a/tempest/lib/cmd/check_uuid.py
+++ b/tempest/lib/cmd/check_uuid.py
@@ -38,7 +38,7 @@
class SourcePatcher(object):
- """"Lazy patcher for python source files"""
+ """Lazy patcher for python source files"""
def __init__(self):
self.source_files = None
@@ -431,14 +431,21 @@
help='Package with tests')
parser.add_argument('--fix', action='store_true', dest='fix_tests',
help='Attempt to fix tests without UUIDs')
+ parser.add_argument('--libpath', action='store', dest='libpath',
+ default=".", type=str,
+ help='Path to package')
+
args = parser.parse_args()
- sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+ sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
+ sys.path.insert(0, args.libpath)
pkg = importlib.import_module(args.package)
+
checker = TestChecker(pkg)
errors = False
tests = checker.get_tests()
untagged = checker.find_untagged(tests)
errors = checker.report_collisions(tests) or errors
+
if args.fix_tests and untagged:
checker.fix_tests(untagged)
else: