def __init__(self, evergreen_api, config_options): """Initialize the object.""" self.evergreen_api = evergreen_api self.config_options = config_options self.test_list = [] # Populate config values for methods like list_tests() _parser.set_options()
def __init__(self, evergreen_api: EvergreenApi, config_options: ConfigOptions): """ Initialize the object. :param evergreen_api: Evergreen API client. :param config_options: Generation configuration options. """ self.evergreen_api = evergreen_api self.config_options = config_options self.test_list = [] # Populate config values for methods like list_tests() _parser.set_options()
import unittest from math import ceil from mock import Mock, patch, MagicMock import requests from shrub.config import Configuration import buildscripts.burn_in_tests as under_test from buildscripts.ciconfig.evergreen import parse_evergreen_file import buildscripts.util.teststats as teststats_utils import buildscripts.resmokelib.parser as _parser import buildscripts.resmokelib.config as _config import buildscripts.evergreen_gen_multiversion_tests as gen_multiversion _parser.set_options() # pylint: disable=missing-docstring,protected-access,too-many-lines,no-self-use def create_tests_by_task_mock(n_tasks, n_tests): return { f"task_{i}": { "resmoke_args": f"--suites=suite_{i}", "tests": [f"jstests/tests_{j}" for j in range(n_tests)] } for i in range(n_tasks) } MV_MOCK_SUITES = [
def tearDown(self): _parser.set_options()
"""Unit tests for buildscripts/resmokelib/suitesconfig.py.""" import unittest import mock from buildscripts.resmokelib import suitesconfig from buildscripts.resmokelib import parser parser.set_options() # pylint: disable=missing-docstring RESMOKELIB = "buildscripts.resmokelib" class TestSuitesConfig(unittest.TestCase): @mock.patch(RESMOKELIB + ".testing.suite.Suite") @mock.patch(RESMOKELIB + ".suitesconfig.get_named_suites") def test_no_suites_matching_test_kind(self, mock_get_named_suites, mock_suite_class): all_suites = ["core", "replica_sets_jscore_passthrough"] mock_get_named_suites.return_value = all_suites membership_map = suitesconfig.create_test_membership_map( test_kind="nonexistent_test") self.assertEqual(membership_map, {}) self.assertEqual(mock_suite_class.call_count, 0) @mock.patch(RESMOKELIB + ".testing.suite.Suite") @mock.patch(RESMOKELIB + ".suitesconfig.get_named_suites")