Skip to content

Commit

Permalink
Clarify Docker Python interpreter verification method
Browse files Browse the repository at this point in the history
Draws a clearer distinction between verifying the interpreter in the container, vs on the host (handled in BaseCommand::verify_required_python), and system Python verification in verify_system_python
  • Loading branch information
sarayourfriend committed Oct 15, 2024
1 parent dde2daf commit a93be65
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/briefcase/platforms/linux/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def clone_options(self, command):
self.target_image = command.target_image
self.extra_docker_build_args = command.extra_docker_build_args

def verify_python(self, app: AppConfig):
def verify_docker_python(self, app: AppConfig):
"""Verify that the version of Python being used to build the app in Docker is
compatible with the version being used to run Briefcase.
Expand Down Expand Up @@ -591,7 +591,7 @@ def verify_app_tools(self, app: AppConfig):
# Check the system Python on the target system to see if it is
# compatible with Briefcase.
if verify_python:
self.verify_python(app)
self.verify_docker_python(app)
else:
NativeAppContext.verify(tools=self.tools, app=app)

Expand Down
16 changes: 8 additions & 8 deletions tests/platforms/linux/system/test_mixin__verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_linux_docker(create_command, first_app_config, tmp_path, monkeypatch):
"verify",
mock_docker_app_context_verify,
)
create_command.verify_python = MagicMock()
create_command.verify_docker_python = MagicMock()

# Verify the tools
create_command.verify_tools()
Expand All @@ -106,14 +106,14 @@ def test_linux_docker(create_command, first_app_config, tmp_path, monkeypatch):
)

# Python was also verified
create_command.verify_python.assert_called_once_with(first_app_config)
create_command.verify_docker_python.assert_called_once_with(first_app_config)

# Reset the mock, then invoke verify_app_tools a second time.
create_command.verify_python.reset_mock()
create_command.verify_docker_python.reset_mock()
create_command.verify_app_tools(app=first_app_config)

# Python will *not* be verified a second time.
create_command.verify_python.assert_not_called()
create_command.verify_docker_python.assert_not_called()


def test_non_linux_docker(create_command, first_app_config, tmp_path, monkeypatch):
Expand Down Expand Up @@ -159,7 +159,7 @@ def test_non_linux_docker(create_command, first_app_config, tmp_path, monkeypatc
"verify",
mock_docker_app_context_verify,
)
create_command.verify_python = MagicMock()
create_command.verify_docker_python = MagicMock()

# Verify the tools
create_command.verify_tools()
Expand All @@ -185,11 +185,11 @@ def test_non_linux_docker(create_command, first_app_config, tmp_path, monkeypatc
)

# Python was also verified
create_command.verify_python.assert_called_once_with(first_app_config)
create_command.verify_docker_python.assert_called_once_with(first_app_config)

# Reset the mock, then invoke verify_app_tools a second time.
create_command.verify_python.reset_mock()
create_command.verify_docker_python.reset_mock()
create_command.verify_app_tools(app=first_app_config)

# Python will *not* be verified a second time.
create_command.verify_python.assert_not_called()
create_command.verify_docker_python.assert_not_called()
6 changes: 3 additions & 3 deletions tests/platforms/linux/system/test_mixin__verify_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_match(create_command, first_app_config, capsys):
)

# Verify python for the app
create_command.verify_python(first_app_config)
create_command.verify_docker_python(first_app_config)

# The docker container was interrogated for a Python version
create_command.tools[
Expand Down Expand Up @@ -62,7 +62,7 @@ def test_mismatch(create_command, first_app_config, capsys):
)

# Verify python for the app
create_command.verify_python(first_app_config)
create_command.verify_docker_python(first_app_config)

# The docker container was interrogated for a Python version
create_command.tools[
Expand Down Expand Up @@ -107,7 +107,7 @@ def test_target_too_old(create_command, first_app_config):
match=r"The system python3 version provided by somevendor:surprising "
r"is 3\.7\.16; Briefcase requires a minimum Python3 version of 3\.9\.",
):
create_command.verify_python(first_app_config)
create_command.verify_docker_python(first_app_config)

# The docker container was interrogated for a Python version
create_command.tools[
Expand Down

0 comments on commit a93be65

Please sign in to comment.