Debian Codegraph @

tests/integrations/file/test_File__verify.py

raw
1 import pytest
2
3 from briefcase.exceptions import UnsupportedHostError
4 from briefcase.integrations.file import File
5
6
7 def test_short_circuit(mock_tools):
8 """Tool is not created if already cached."""
9 mock_tools.file = "tool"
10
11 tool = File.verify(mock_tools)
12
13 assert tool == "tool"
14 assert tool == mock_tools.file
15
16
17 def test_unsupported_os(mock_tools):
18 """When host OS is not supported, an error is raised."""
19 mock_tools.host_os = "wonky"
20
21 # Delete download since it has already been verified
22 delattr(mock_tools, "file")
23
24 with pytest.raises(
25 UnsupportedHostError,
26 match=f"{File.name} is not supported on wonky",
27 ):
28 File.verify(mock_tools)
29
30
31 def test_verify(mock_tools):
32 """Verifying Download always returns/set download tool."""
33 file_tool = File.verify(mock_tools)
34 assert isinstance(file_tool, File)
35 assert file_tool is mock_tools.file