Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support for zipapp-based python standalone application #5780

@RyanSiu1995

Description

@RyanSiu1995

Since python 3.5, developers can release their application through zipapp. It provides a great functionality in standalone application delivery.
But how can we ensure the packaged app is well-tested with pytest? Right before the packaging, we can use pytest scan through the whole repo. After the package, there is no way to test through the packaged application. There may be some issues during the packaging.
In order to facilitate the delivery of the standalone application, the support for zipapp from pytest is necessary.
I have two proposals for this issue.

  1. Support zipapp scanning, e.g. pytest myapplication.pyz
    This approach assumes the test cases are packaged along with the source code. If pytest detects the file format as pyz, it will decompress the zip file and scan through the directory. A quick and brute force solution in the support of zipapp-based application.
  2. Add --zipapp=app.pyz as a support flag
    This solution assumes the test cases are not packaged along with the source code. In my past experience in the development, test cases are not necessary for runtime. They, in general, are not included in the built binary. Based on this assumption, the developer can package a test-free standalone application with the following file structure
| - app.pyz
| - src/
| - tests/
    | - test_a.py
    | - test_b.py

Then, the developers can invoke a command like this pytest --zipapp=app.pyz tests/. Pytest will then create a virtualenv with the zipapp for running those tests.

Please let me know if there is a function like this. I will delete the issue afterward.
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions