File: conftest.py

package info (click to toggle)
python-briefcase 0.3.25-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,596 kB
  • sloc: python: 62,519; makefile: 60
file content (62 lines) | stat: -rw-r--r-- 1,470 bytes parent folder | download | duplicates (2)
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
import pytest

from ....utils import create_file, create_wheel


@pytest.fixture
def first_app_generated(first_app_config, tmp_path):
    # Create the briefcase.toml file
    bundle_path = tmp_path / "base_path/build/first-app/web/static"
    create_file(
        bundle_path / "briefcase.toml",
        """
[paths]
app_path="app"
app_requirements_path="requirements.txt"
""",
    )

    # Create index.html
    create_file(bundle_path / "www/index.html", "<html></html>")

    # Create the initial pyscript.toml
    create_file(
        bundle_path / "www/pyscript.toml",
        """
existing-key-1 = "value-1"
existing-key-2 = 2
""",
    )

    # Create the initial briefcase.css
    create_file(
        bundle_path / "www/static/css/briefcase.css",
        """
#pyconsole {
  display: None;
}
/*******************************************************************
 ******************** Wheel contributed styles ********************/
""",
    )

    # Create an empty wheels folder
    (bundle_path / "www/static/wheels").mkdir(parents=True)

    return first_app_config


@pytest.fixture
def first_app_built(first_app_generated, tmp_path):
    bundle_path = tmp_path / "base_path/build/first-app/web/static"

    # Create pyscript.toml
    create_file(
        bundle_path / "www/pyscript.toml",
        'packages = ["dummy-1.2.3-py3-none-all.whl"]',
    )

    # Create an app wheel
    create_wheel(bundle_path / "www/static/wheels")

    return first_app_generated