File: conftest.py

package info (click to toggle)
python-installer 0.7.0%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 400 kB
  • sloc: python: 2,845; makefile: 11; sh: 8
file content (73 lines) | stat: -rw-r--r-- 2,556 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import textwrap
import zipfile

import pytest


@pytest.fixture
def fancy_wheel(tmp_path):
    path = tmp_path / "fancy-1.0.0-py2.py3-none-any.whl"
    files = {
        "fancy/": b"""""",
        "fancy/__init__.py": b"""\
            def main():
                print("I'm fancy.")
        """,
        "fancy/__main__.py": b"""\
            if __name__ == "__main__":
                from . import main
                main()
        """,
        "fancy-1.0.0.data/data/fancy/": b"""""",
        "fancy-1.0.0.data/data/fancy/data.py": b"""\
            # put me in data
        """,
        "fancy-1.0.0.dist-info/": b"""""",
        "fancy-1.0.0.dist-info/top_level.txt": b"""\
            fancy
        """,
        "fancy-1.0.0.dist-info/entry_points.txt": b"""\
            [console_scripts]
            fancy = fancy:main

            [gui_scripts]
            fancy-gui = fancy:main
        """,
        "fancy-1.0.0.dist-info/WHEEL": b"""\
            Wheel-Version: 1.0
            Generator: magic (1.0.0)
            Root-Is-Purelib: true
            Tag: py3-none-any
        """,
        "fancy-1.0.0.dist-info/METADATA": b"""\
            Metadata-Version: 2.1
            Name: fancy
            Version: 1.0.0
            Summary: A fancy package
            Author: Agendaless Consulting
            Author-email: nobody@example.com
            License: MIT
            Keywords: fancy amazing
            Platform: UNKNOWN
            Classifier: Intended Audience :: Developers
        """,
        "fancy-1.0.0.dist-info/RECORD": b"""\
            fancy/__init__.py,sha256=qZ2qq7xVBAiUFQVv-QBHhdtCUF5p1NsWwSOiD7qdHN0,36
            fancy/__main__.py,sha256=Wd4SyWJOIMsHf_5-0oN6aNFwen8ehJnRo-erk2_K-eY,61
            fancy-1.0.0.data/data/fancy/data.py,sha256=nuFRUNQF5vP7FWE-v5ysyrrfpIaAvfzSiGOgfPpLOeI,17
            fancy-1.0.0.dist-info/top_level.txt,sha256=SW-yrrF_c8KlserorMw54inhLjZ3_YIuLz7fYT4f8ao,6
            fancy-1.0.0.dist-info/entry_points.txt,sha256=AxJl21_zgoNWjCfvSkC9u_rWSzGyCtCzhl84n979jCc,75
            fancy-1.0.0.dist-info/WHEEL,sha256=1DrXMF1THfnBjsdS5sZn-e7BKcmUn7jnMbShGeZomgc,84
            fancy-1.0.0.dist-info/METADATA,sha256=hRhZavK_Y6WqKurFFAABDnoVMjZFBH0NJRjwLOutnJI,236
            fancy-1.0.0.dist-info/RECORD,,
        """,
    }

    with zipfile.ZipFile(path, "w") as archive:
        for name, indented_content in files.items():
            archive.writestr(
                name,
                textwrap.dedent(indented_content.decode("utf-8")).encode("utf-8"),
            )

    return path