#!/usr/bin/python2
# -*- coding: utf-8 -*-

import os
import sys

# Simulate PYTHONPATH, add our plugin directory
MODULE_DIR = os.path.abspath("../")
sys.path.insert(0, MODULE_DIR)
# Add /usr/lib/molecule to PYTHONPATH
sys.path.append("/usr/lib/molecule")

_plugins = [
    "src.builtin_plugin",
    "src.remaster_plugin",
    "src.mmc_plugin",
    "src.image_plugin",
    "src.tar_plugin"]
os.environ["MOLECULE_PLUGIN_MODULES"] = ":".join(_plugins)


import unittest
sys.path.insert(0, '.')
sys.path.insert(0, '..')

from tests import parsers
rc = 0

# Add to the list the module to test
mods = [parsers]

tests = []
for mod in mods:
    tests.append(unittest.TestLoader().loadTestsFromModule(mod))

result = unittest.TextTestRunner(verbosity=1).run(unittest.TestSuite(tests))
if result.errors:
    rc = 1
raise SystemExit(rc)
