@mock.patch.object(shutil, 'rmtree', autospec=True)
@mock.patch.object(tempfile, 'mkdtemp', autospec=True)
def test_tempdir_mocked(self, mkdtemp_mock, rmtree_mock):
    self.config(tempdir='abc')
    mkdtemp_mock.return_value = 'temp-dir'
    kwargs = {'dir': 'b'}
    with utils.tempdir(**kwargs) as tempdir:
        self.assertEqual('temp-dir', tempdir)
        tempdir_created = tempdir
    mkdtemp_mock.assert_called_once_with(**kwargs)
    rmtree_mock.assert_called_once_with(tempdir_created)
@mock.patch.object(shutil, 'rmtree', autospec=True)
@mock.patch.object(tempfile, 'mkdtemp', autospec=True)
def test_tempdir_mocked(self, mkdtemp_mock, rmtree_mock):
    self.config(tempdir='abc')
    mkdtemp_mock.return_value = 'temp-dir'
    kwargs = {'dir': 'b'}
    with utils.tempdir(**kwargs) as tempdir:
        self.assertEqual('temp-dir', tempdir)
        tempdir_created = tempdir
    mkdtemp_mock.assert_called_once_with(**kwargs)
    rmtree_mock.assert_called_once_with(tempdir_created)