def _test(self, size): suites = [create_suite(start=3 * i) for i in range(size)] expected = [ self.EXPECTED_FORMAT.format(*list(range(3 * i, 3 * (i + 1)))) for i in range(len(suites)) ] m = mock_open(read_data=yaml.dump({"selector": {"roots": [], "excludes": ["fixed"]}})) with patch(ns("open"), m, create=True): render_suite(suites, "suite_name") handle = m() # The other writes are for the headers. self.assertEqual(len(suites) * 2, handle.write.call_count) handle.write.assert_has_calls([call(e) for e in expected], any_order=True) calls = [ call(os.path.join(grt.TEST_SUITE_DIR, "suite_name.yml"), "r") for _ in range(len(suites)) ] m.assert_has_calls(calls, any_order=True) filename = os.path.join(grt.CONFIG_DIR, "suite_name_{{:0{}}}.yml".format( int(math.ceil(math.log10(size))))) calls = [call(filename.format(i), "w") for i in range(size)] m.assert_has_calls(calls, any_order=True)
def _test(self, size): suites = [create_suite(start=3 * i) for i in range(size)] expected = [ self.EXPECTED_FORMAT.format(*list(range(3 * i, 3 * (i + 1)))) for i in range(len(suites)) ] m = mock_open(read_data=yaml.dump( {"selector": { "roots": [], "excludes": ["fixed"] }})) with patch(ns("open"), m, create=True): render_suite(suites, "suite_name") handle = m() # The other writes are for the headers. self.assertEqual(len(suites) * 2, handle.write.call_count) handle.write.assert_has_calls([call(e) for e in expected], any_order=True) calls = [ call(os.path.join(grt.TEST_SUITE_DIR, "suite_name.yml"), "r") for _ in range(len(suites)) ] m.assert_has_calls(calls, any_order=True) filename = os.path.join( grt.CONFIG_DIR, "suite_name_{{:0{}}}.yml".format(int(math.ceil(math.log10(size))))) calls = [call(filename.format(i), "w") for i in range(size)] m.assert_has_calls(calls, any_order=True)
def _test(self, size): suites = [create_suite(start=3 * i) for i in range(size)] expected = [ self.EXPECTED_FORMAT.format(*range(3 * i, 3 * (i + 1))) for i in range(len(suites)) ] m = mock_open(read_data=yaml.dump( {'selector': { 'roots': [], 'excludes': ['fixed'] }})) with patch('buildscripts.evergreen_generate_resmoke_tasks.open', m, create=True): render_suite(suites, 'suite_name') handle = m() # The other writes are for the headers. self.assertEquals(len(suites) * 2, handle.write.call_count) handle.write.assert_has_calls([call(e) for e in expected], any_order=True) calls = [ call(os.path.join(grt.TEST_SUITE_DIR, 'suite_name.yml'), 'r') for _ in range(len(suites)) ] m.assert_has_calls(calls, any_order=True) filename = os.path.join( grt.CONFIG_DIR, 'suite_name_{{:0{}}}.yml'.format(int(math.ceil(math.log10(size))))) calls = [call(filename.format(i), 'w') for i in range(size)] m.assert_has_calls(calls, any_order=True)
def _test(self, size): suites = [create_suite(start=3 * i) for i in range(size)] expected = [ self.EXPECTED_FORMAT.format(*range(3 * i, 3 * (i + 1))) for i in range(len(suites)) ] m = mock_open(read_data=yaml.dump({'selector': {'roots': [], 'excludes': ['fixed']}})) with patch('buildscripts.evergreen_generate_resmoke_tasks.open', m, create=True): render_suite(suites, 'suite_name') handle = m() # The other writes are for the headers. self.assertEquals(len(suites) * 2, handle.write.call_count) handle.write.assert_has_calls([call(e) for e in expected], any_order=True) calls = [ call(os.path.join(grt.TEST_SUITE_DIR, 'suite_name.yml'), 'r') for _ in range(len(suites)) ] m.assert_has_calls(calls, any_order=True) filename = os.path.join(grt.CONFIG_DIR, 'suite_name_{{:0{}}}.yml'.format( int(math.ceil(math.log10(size))))) calls = [call(filename.format(i), 'w') for i in range(size)] m.assert_has_calls(calls, any_order=True)