File: test_libusb1_packaging.py

package info (click to toggle)
python-libusb1 3.3.1%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 488 kB
  • sloc: python: 3,259; sh: 98; makefile: 5
file content (37 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
PyTest testcases for the pyinstaller hook

Instructions to run these tests:

- Install PyInstaller with the hook_testing extra requirements:
  > pip install pyinstaller[hook_testing]

- Run the tests using the provided utility by pyinstaller:
  > python -m PyInstaller.utils.run_tests --include_only usb1

"""
# pylint: disable=missing-function-docstring
import subprocess
# pylint: disable=import-error
from PyInstaller import __main__ as pyi_main
# pylint: enable=import-error


def test_pyi_hooksample(tmp_path):
    app_name = "userapp"
    workpath = tmp_path / "build"
    distpath = tmp_path / "dist"
    app = tmp_path / (app_name + ".py")
    app.write_text("\n".join([
        "import usb1",
        "print(usb1.getVersion())"
    ]))
    args = [
        # Place all generated files in ``tmp_path``.
        '--workpath', str(workpath),
        '--distpath', str(distpath),
        '--specpath', str(tmp_path),
        str(app),
    ]
    pyi_main.run(args)
    subprocess.run([str(distpath / app_name / app_name)], check=True)