def test_make_profile_missing(mock_temp): """tests.oglconform._make_profile: handles missing groups""" io_ = mock.Mock(wraps=StringIO(u'test.name\n')) io_.name = mock.Mock() mock_file = mock.MagicMock() mock_file.__enter__.return_value = io_ mock_temp.return_value = mock_file with mock.patch('subprocess.call', mock.Mock()): oglconform._make_profile()
def test_missing(self, mocker): """tests.oglconform._make_profile: handles missing groups""" io_ = mocker.Mock(wraps=StringIO(u'test.name\n')) io_.name = mocker.Mock() mock_file = mocker.MagicMock() mock_file.__enter__.return_value = io_ mock_temp = mocker.patch.object(oglconform.tempfile, 'NamedTemporaryFile') mock_temp.return_value = mock_file mocker.patch('subprocess.call', mocker.Mock()) oglconform._make_profile()
def test_make_profile(mock_temp): """tests.oglconform._make_profile: Adds test names""" io_ = mock.Mock(wraps=StringIO(u'group test.name\n')) io_.name = mock.Mock() mock_file = mock.MagicMock() mock_file.__enter__.return_value = io_ mock_temp.return_value = mock_file with mock.patch('subprocess.call', mock.Mock()): profile = oglconform._make_profile() name = grouptools.join('oglconform', 'group', 'test.name') nt.ok_(name in profile.test_list, msg='{} not in {}'.format(name, profile.test_list.keys()))
def test_basic(self, mocker): """tests.oglconform._make_profile: Adds test names""" io_ = mocker.Mock(wraps=StringIO(u'group test.name\n')) io_.name = mocker.Mock() mock_file = mocker.MagicMock() mock_file.__enter__.return_value = io_ mock_temp = mocker.patch.object(oglconform.tempfile, 'NamedTemporaryFile') mock_temp.return_value = mock_file mocker.patch('subprocess.call', mocker.Mock()) profile = oglconform._make_profile() name = grouptools.join('oglconform', 'group', 'test.name') assert name in profile.test_list