Exemplo n.º 1
0
def test_filesystem_image_sandbox_create_ioerror(makedirs):
  makedirs.side_effect = IOError('Disk is borked')

  with mock.patch.dict('os.environ', {
    FileSystemImageSandbox.MESOS_DIRECTORY_ENV_VARIABLE: 'some-directory',
    FileSystemImageSandbox.MESOS_SANDBOX_ENV_VARIABLE: 'some-sandbox'
  }):
    with temporary_dir() as d:
      real_path = os.path.join(d, 'sandbox')
      ds = FileSystemImageSandbox(real_path)
      with pytest.raises(DirectorySandbox.CreationError):
        ds.create()
Exemplo n.º 2
0
def test_filesystem_image_sandbox_create_ioerror(makedirs):
    makedirs.side_effect = IOError('Disk is borked')

    with mock.patch.dict(
            'os.environ',
        {
            FileSystemImageSandbox.MESOS_DIRECTORY_ENV_VARIABLE:
            'some-directory',
            FileSystemImageSandbox.MESOS_SANDBOX_ENV_VARIABLE: 'some-sandbox'
        }):
        with temporary_dir() as d:
            real_path = os.path.join(d, 'sandbox')
            ds = FileSystemImageSandbox(real_path)
            with pytest.raises(DirectorySandbox.CreationError):
                ds.create()