File: test_cleanup_stub_binary.py

package info (click to toggle)
python-briefcase 0.3.22-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,300 kB
  • sloc: python: 59,405; makefile: 57
file content (35 lines) | stat: -rw-r--r-- 988 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
import pytest

from ...utils import create_file


@pytest.mark.parametrize(
    "unbuilt, built",
    [
        (True, True),
        (True, False),
        (False, True),
        (False, False),
    ],
)
def test_cleanup_stubs(create_command, unbuilt, built, myapp, tmp_path):
    """If an unbuilt stub already exists, it is cleaned up."""

    # Mock a existing stubs
    if unbuilt:
        create_file(
            tmp_path / "base_path/build/my-app/tester/dummy/Stub.bin",
            "Unbuilt stub",
        )
    if built:
        create_file(
            tmp_path / "base_path/build/my-app/tester/dummy/my-app.bin",
            "Built stub",
        )

    # Re-install the support package
    create_command.cleanup_stub_binary(myapp)

    # No matter the starting state, the stubs don't exist after cleanup.
    assert not (tmp_path / "base_path/build/my-app/tester/dummy/Stub.bin").exists()
    assert not (tmp_path / "base_path/build/my-app/tester/dummy/my-app.bin").exists()