def test__remove_pyleus_base_jar_no_remove(self): """Do not remove the base jar if it is outside the virtualenv""" mock_venv_path = "/path/to/venv" def mock_execute_module(module, cwd): return "/foo/bar/outside.jar" mock_venv = mock.Mock( path=mock_venv_path, execute_module=mock_execute_module, ) with mock.patch.object(os, 'remove') as mock_remove: build._remove_pyleus_base_jar(mock_venv) assert not mock_remove.called
def test__remove_pyleus_base_jar(self): """Remove the base jar if it is inside the virtualenv""" mock_venv_path = "/path/to/venv" def mock_execute_module(module, cwd): return "/path/to/venv/inside.jar" mock_venv = mock.Mock( path=mock_venv_path, execute_module=mock_execute_module, ) with mock.patch.object(os, 'remove') as mock_remove: build._remove_pyleus_base_jar(mock_venv) mock_remove.assert_called_once_with("/path/to/venv/inside.jar")