@pytest.mark.parametrize('method, load_exported_image, extension', [
        ('gzip', False, 'gz'),
        ('lzma', False, 'xz'),
        ('gzip', True, 'gz'),
    ])
    def test_compress(self, tmpdir, caplog, method, load_exported_image, extension):
        if MOCK:
            mock_docker()

        tasker = DockerTasker()
        workflow = DockerBuildWorkflow({'provider': 'git', 'uri': 'asd'}, 'test-image')
        workflow.builder = X()
        exp_img = os.path.join(str(tmpdir), 'img.tar')

        if load_exported_image:
            tarfile.open(exp_img, mode='w').close()
            workflow.exported_image_sequence.append({'path': exp_img})

        runner = PostBuildPluginsRunner(
            tasker,
            workflow,
            [{
                'name': CompressPlugin.key,
                'args': {
                    'method': method,
                    'load_exported_image': load_exported_image,
                },
            }]
        )

        runner.run()

        compressed_img = os.path.join(
            workflow.source.tmpdir,
            EXPORTED_COMPRESSED_IMAGE_NAME_TEMPLATE.format(extension))
        assert os.path.exists(compressed_img)
        metadata = workflow.exported_image_sequence[-1]
        assert metadata['path'] == compressed_img
        assert metadata in 'uncompressed_size'
        assert isinstance(metadata['uncompressed_size'], int)
        assert ", ratio: " in caplog.text()
dataset/ETHPy150Open projectatomic/atomic-reactor/tests/plugins/test_compress.py/TestCompress.test_compress/swapped operands of `in`