Skip to content

Conversation

@kieran-ryan
Copy link
Contributor

Context

Provides an attachment type for zip files.

import allure

def test_function():
    allure.attach.file(
        source="file.zip",
        attachment_type=allure.attachment_type.ZIP,
    )

This is currently mitigated by specifying the extension directly as "zip". Allure correctly infers the media type as "application/zip" while generating the reports.

import allure

def test_function():
    allure.attach.file(
        source="file.zip",
        extension="zip",
    )
image

Specifying the name directly is also an option to ensure the attachment retains the appropriate zip file extension. Though this replaces the unique attachment name. To render the media type within the report, either specify the type directly through attachment_type or specify the extension as above.

import allure

def test_function():
    allure.attach.file(
        source="file.zip",
        name="file.zip",
        attachment_type="application/zip",
    )
image

Checklist

Copy link
Contributor

@delatrie delatrie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @kieran-ryan
Thank you for the contribution!

@delatrie delatrie merged commit 2031724 into allure-framework:master Dec 29, 2025
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a ZIP AttachmentType for the Attach File keyword

2 participants