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
|
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"
/ create_command.exe_name("Stub"),
"Unbuilt stub",
)
if built:
create_file(
tmp_path
/ "base_path/build/my-app/tester/dummy"
/ create_command.exe_name(myapp.formal_name),
"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"
/ create_command.exe_name("Stub")
).exists()
assert not (
tmp_path
/ "base_path/build/my-app/tester/dummy"
/ create_command.exe_name(myapp.formal_name)
).exists()
|