def test_install_app_dependencies(first_app_config, tmp_path): "If Docker is in use, a docker context is used to invoke pip" first_app_config.requires = ['foo==1.2.3', 'bar>=4.5'] command = LinuxAppImageCreateCommand(base_path=tmp_path) command.use_docker = True command.subprocess = MagicMock() docker = MagicMock() command.Docker = MagicMock() command.Docker.return_value = docker command._path_index = { first_app_config: { 'app_packages_path': 'path/to/app_packages' } } command.install_app_dependencies(first_app_config) # A docker context was created command.Docker.assert_called_with(command, first_app_config) # The docker container was prepared docker.prepare.assert_called_with() # pip was invoked inside docker. docker.run.assert_called_with( [ sys.executable, '-m', 'pip', 'install', '--upgrade', '--target={tmp_path}/linux/First App/path/to/app_packages'.format( tmp_path=tmp_path ), 'foo==1.2.3', 'bar>=4.5', ], check=True )
def test_docker_image_tag_uppercase_name(uppercase_app_config, tmp_path): command = LinuxAppImageCreateCommand(base_path=tmp_path) image_tag = command.docker_image_tag(uppercase_app_config) assert image_tag == f"briefcase/com.example.first-app:py3.{sys.version_info.minor}"
def test_bundle_path(first_app_config, tmp_path): command = LinuxAppImageCreateCommand(base_path=tmp_path) bundle_path = command.bundle_path(first_app_config) assert bundle_path == tmp_path / 'linux' / 'First App.AppDir'