-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
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.
- 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. - Add
--zipapp=app.pyzas 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!