Example #1
0
    def __init__(self):
        self.print_mug()
        self.cl_args = ArgumentParser().parse_args()
        self.test_env = TestEnvManager("",
                                       self.cl_args.config,
                                       test_repo_package_name="")
        self.test_env.test_data_directory = self.test_env.test_data_directory
        self.test_env.finalize()
        cclogging.init_root_log_handler()

        # This is where things diverge from the regular parallel runner
        # Extract the runfile contents
        self._log = cclogging.getLogger(
            cclogging.get_object_namespace(self.__class__))
        self.datagen_start = time.time()
        self.run_file = BrewFile(self.cl_args.runfiles)

        # Log the runfile here so that it appears in the logs before any tests
        self._log.debug("\n" + str(self.run_file))

        # TODO: Once the parallel_runner is changed to a yielding model,
        #       change this to yielding brews instead of generating a list
        self.suites = SuiteBuilder(testrepos=self.run_file.brew_modules(),
                                   dry_run=self.cl_args.dry_run,
                                   exit_on_error=True).get_suites()

        self.print_configuration(self.test_env, brewfile=self.run_file)
Example #2
0
    def run(cls):
        global result
        requests.packages.urllib3.disable_warnings()
        try:
            cls.print_symbol()
            usage = """
                syntribos <config> <input_file> --test-types=TEST_TYPES
                syntribos <config> <input_file> -t TEST_TYPE TEST_TYPE ...
                syntribos <config> <input_file>
                """
            args, unknown = syntribos.arguments.SyntribosCLI(
                usage=usage).parse_known_args()
            test_env_manager = TestEnvManager(
                "", args.config, test_repo_package_name="os")
            test_env_manager.finalize()
            cls.set_env()
            init_root_log_handler()

            cls.print_log()
            result = unittest.TextTestResult(
                unittest.runner._WritelnDecorator(sys.stdout),
                True, 2 if args.verbose else 1)
            start_time = time.time()
            for file_path, req_str in args.input:
                for test_name, test_class in cls.get_tests(args.test_types):
                    for test in test_class.get_test_cases(file_path, req_str):
                        cls.run_test(test, result, args.dry_run)
            cls.print_result(result, start_time)
        except KeyboardInterrupt:
            cafe.drivers.base.print_exception(
                "Runner",
                "run",
                "Keyboard Interrupt, exiting...")
            exit(0)
Example #3
0
    def __init__(self):
        self.print_mug()
        self.cl_args = ArgumentParser().parse_args()
        self.test_env = TestEnvManager(
            "", self.cl_args.config, test_repo_package_name="")
        self.test_env.test_data_directory = self.test_env.test_data_directory
        self.test_env.finalize()
        cclogging.init_root_log_handler()

        # This is where things diverge from the regular parallel runner
        # Extract the runfile contents
        self._log = cclogging.getLogger(
            cclogging.get_object_namespace(self.__class__))
        self.datagen_start = time.time()
        self.run_file = BrewFile(self.cl_args.runfiles)

        # Log the runfile here so that it appears in the logs before any tests
        self._log.debug("\n" + str(self.run_file))

        # TODO: Once the parallel_runner is changed to a yielding model,
        #       change this to yielding brews instead of generating a list
        self.suites = SuiteBuilder(
            testrepos=self.run_file.brew_modules(),
            dry_run=self.cl_args.dry_run,
            exit_on_error=True).get_suites()

        self.print_configuration(self.test_env, brewfile=self.run_file)
Example #4
0
 def setUpClass(cls):
     super(BaseTestFixture, cls).setUpClass()
     #Move root log handler initialization to the runner!
     init_root_log_handler()
     cls._reporter = FixtureReporter(cls)
     cls.fixture_log = cls._reporter.logger.log
     cls._reporter.start()
     cls._class_cleanup_tasks = []
Example #5
0
def pytest_configure(config):

    if config.getoption('cafe_proj') and config.getoption('cafe_config'):
        # Setting test repo path variables to pass checks
        # to validate if the test repos exist
        os.environ['CAFE_ALLOW_MANAGED_ENV_VAR_OVERRIDES'] = '1'
        os.environ['CAFE_TEST_REPO_PATH'] = config.args[0]
        test_env = TestEnvManager(config.getoption('cafe_proj'),
                                  config.getoption('cafe_config') + '.config',
                                  test_repo_package_name=config.args[0])
        test_env.finalize()
        cclogging.init_root_log_handler()
        UnittestRunner.print_mug_and_paths(test_env)
Example #6
0
    def __init__(self):
        self.cl_args = _UnittestRunnerCLI().get_cl_args()
        self.test_env = TestEnvManager(
            self.cl_args.product, self.cl_args.config,
            test_repo_package_name=self.cl_args.test_repo)

        # If something in the cl_args is supposed to override a default, like
        # say that data directory or something, it needs to happen before
        # finalize() is called
        self.test_env.test_data_directory = (
            self.test_env.test_data_directory or self.cl_args.data_directory)
        self.test_env.finalize()
        init_root_log_handler()
        self.product = self.cl_args.product
        self.print_mug_and_paths(self.test_env)
Example #7
0
    def __init__(self):
        self.cl_args = _UnittestRunnerCLI().get_cl_args()
        self.test_env = TestEnvManager(
            self.cl_args.product,
            self.cl_args.config,
            test_repo_package_name=self.cl_args.test_repo)

        # If something in the cl_args is supposed to override a default, like
        # say that data directory or something, it needs to happen before
        # finalize() is called
        self.test_env.test_data_directory = (self.test_env.test_data_directory
                                             or self.cl_args.data_directory)
        self.test_env.finalize()
        init_root_log_handler()
        self.product = self.cl_args.product
        self.print_mug_and_paths(self.test_env)
Example #8
0
    def __init__(self):
        self.print_mug()
        self.cl_args = ArgumentParser().parse_args()
        self.test_env = TestEnvManager("", self.cl_args.config, test_repo_package_name="")
        self.test_env.test_data_directory = self.cl_args.data_directory or self.test_env.test_data_directory
        self.test_env.finalize()
        cclogging.init_root_log_handler()
        self.print_configuration(self.test_env, self.cl_args.testrepos)
        self.cl_args.testrepos = import_repos(self.cl_args.testrepos)

        self.suites = SuiteBuilder(
            testrepos=self.cl_args.testrepos,
            tags=self.cl_args.tags,
            all_tags=self.cl_args.all_tags,
            regex_list=self.cl_args.regex_list,
            file_=self.cl_args.file,
            dry_run=self.cl_args.dry_run,
            exit_on_error=self.cl_args.exit_on_error,
        ).get_suites()
Example #9
0
    def __init__(self):
        self.print_mug()
        self.cl_args = ArgumentParser().parse_args()
        self.test_env = TestEnvManager("",
                                       self.cl_args.config,
                                       test_repo_package_name="")
        self.test_env.test_data_directory = (self.cl_args.data_directory or
                                             self.test_env.test_data_directory)
        self.test_env.finalize()
        cclogging.init_root_log_handler()
        self.print_configuration(self.test_env, self.cl_args.testrepos)
        self.cl_args.testrepos = import_repos(self.cl_args.testrepos)

        self.suites = SuiteBuilder(
            testrepos=self.cl_args.testrepos,
            tags=self.cl_args.tags,
            all_tags=self.cl_args.all_tags,
            regex_list=self.cl_args.regex_list,
            file_=self.cl_args.file,
            dry_run=self.cl_args.dry_run,
            exit_on_error=self.cl_args.exit_on_error).get_suites()
Example #10
0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from collections import OrderedDict
from mock import MagicMock, Mock
from requests import Response
import sys
import unittest

from cafe.common.reporting import cclogging
from cafe.configurator.managers import _lazy_property
cclogging.init_root_log_handler()
from cloudcafe.common.behaviors import StatusProgressionVerifierError
from cloudcafe.compute.volume_attachments_api.behaviors import \
    VolumeAttachmentsAPI_Behaviors
from cloudcafe.compute.volume_attachments_api.client import \
    VolumeAttachmentsAPIClient
from cloudcafe.compute.volume_attachments_api.config import \
    VolumeAttachmentsAPIConfig
from cloudcafe.blockstorage.volumes_api.v2.client import \
    VolumesClient
from cloudcafe.blockstorage.volumes_api.v2.models.responses import \
    VolumeResponse

class MockBuilder(object):

    def _mock(self, name, **defaults):
Example #11
0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from collections import OrderedDict
from mock import MagicMock, Mock
from requests import Response
import sys
import unittest

from cafe.common.reporting import cclogging
from cafe.configurator.managers import _lazy_property
cclogging.init_root_log_handler()
from cloudcafe.common.behaviors import StatusProgressionVerifierError
from cloudcafe.compute.volume_attachments_api.behaviors import \
    VolumeAttachmentsAPI_Behaviors
from cloudcafe.compute.volume_attachments_api.client import \
    VolumeAttachmentsAPIClient
from cloudcafe.compute.volume_attachments_api.config import \
    VolumeAttachmentsAPIConfig
from cloudcafe.blockstorage.volumes_api.v2.client import \
    VolumesClient
from cloudcafe.blockstorage.volumes_api.v2.models.responses import \
    VolumeResponse


class MockBuilder(object):
    def _mock(self, name, **defaults):