Skip to content

Commit

Permalink
trivial: Resolve changes from latest black
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Finucane <[email protected]>
  • Loading branch information
stephenfin committed Jan 17, 2024
1 parent fae635d commit 945f5ce
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 51 deletions.
1 change: 0 additions & 1 deletion pwclient/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ def check_create(

class REST(API):
def __init__(self, server, *, username=None, password=None, token=None):

# TODO(stephenfin): We want to deprecate this behavior at some point
parsed_server = urllib.parse.urlparse(server)
scheme = parsed_server.scheme or 'http'
Expand Down
6 changes: 0 additions & 6 deletions tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def test_patch_id_from_hash():


def test_list_patches(capsys):

fake_patches = fakes.fake_patches()

patches._list_patches(fake_patches)
Expand All @@ -69,7 +68,6 @@ def test_list_patches(capsys):


def test_list_patches__format_option(capsys):

fake_patches = fakes.fake_patches()

patches._list_patches(fake_patches, '%{state}')
Expand All @@ -87,7 +85,6 @@ def test_list_patches__format_option(capsys):


def test_list_patches__format_option_with_msgid(capsys):

fake_patches = fakes.fake_patches()

patches._list_patches(fake_patches, '%{_msgid_}')
Expand All @@ -106,7 +103,6 @@ def test_list_patches__format_option_with_msgid(capsys):

@mock.patch.object(patches, '_list_patches')
def test_action_list__no_submitter_no_delegate(mock_list_patches, capsys):

api = mock.Mock()

patches.action_list(api, FAKE_PROJECT)
Expand All @@ -130,7 +126,6 @@ def test_action_list__no_submitter_no_delegate(mock_list_patches, capsys):

@mock.patch.object(patches, '_list_patches')
def test_action_list__submitter_filter(mock_list_patches, capsys):

api = mock.Mock()
api.patch_list.return_value = fakes.fake_patches()

Expand Down Expand Up @@ -162,7 +157,6 @@ def test_action_list__submitter_filter(mock_list_patches, capsys):

@mock.patch.object(patches, '_list_patches')
def test_action_list__delegate_filter(mock_list_patches, capsys):

api = mock.Mock()
api.patch_list.return_value = fakes.fake_patches()

Expand Down
43 changes: 0 additions & 43 deletions tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def test_no_project_url(mock_config, capsys):

@mock.patch.object(utils.configparser, 'ConfigParser')
def test_missing_project(mock_config, capsys):

mock_config.return_value = FakeConfig()

with pytest.raises(SystemExit):
Expand All @@ -139,7 +138,6 @@ def test_missing_project(mock_config, capsys):
@mock.patch.object(shell.os.path, 'exists', new=mock.Mock(return_value=True))
@mock.patch.object(utils, 'migrate_old_config_file')
def test_migrate_config(mock_migrate, mock_config):

fake_config = FakeConfig(
{
'base': {
Expand All @@ -165,7 +163,6 @@ def test_migrate_config(mock_migrate, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_server_error(mock_action, mock_api, mock_config, capsys):

mock_config.return_value = FakeConfig()
mock_api.side_effect = exceptions.APIError('Unable to connect')

Expand All @@ -182,7 +179,6 @@ def test_server_error(mock_action, mock_api, mock_config, capsys):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_apply(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()
mock_action.return_value = None

Expand Down Expand Up @@ -210,7 +206,6 @@ def test_apply(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_apply__failed(mock_action, mock_api, mock_config, capsys):

mock_config.return_value = FakeConfig()
mock_action.side_effect = [0, 0, 1]

Expand All @@ -233,7 +228,6 @@ def test_apply__failed(mock_action, mock_api, mock_config, capsys):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(checks, 'action_create')
def test_check_create(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig(
{
DEFAULT_PROJECT: {
Expand Down Expand Up @@ -277,7 +271,6 @@ def test_check_create__no_auth(
mock_config,
capsys,
):

mock_config.return_value = FakeConfig()

with pytest.raises(SystemExit):
Expand Down Expand Up @@ -306,7 +299,6 @@ def test_check_create__no_auth(
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(checks, 'action_info')
def test_check_info(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['check-info', '1', '1'])
Expand All @@ -318,7 +310,6 @@ def test_check_info(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(checks, 'action_info')
def test_check_info__no_patch_id(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['check-info', '1'])
Expand All @@ -330,7 +321,6 @@ def test_check_info__no_patch_id(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(checks, 'action_list')
def test_check_list(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['check-list'])
Expand All @@ -342,7 +332,6 @@ def test_check_list(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_get')
def test_get__numeric_id(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()
mock_action.return_value = None

Expand All @@ -355,7 +344,6 @@ def test_get__numeric_id(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_get')
def test_get__multiple_ids(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()
mock_action.return_value = None

Expand All @@ -375,7 +363,6 @@ def test_get__multiple_ids(mock_action, mock_api, mock_config):
@mock.patch.object(patches, 'patch_id_from_hash')
@mock.patch.object(patches, 'action_get')
def test_get__hash_ids(mock_action, mock_hash, mock_api, mock_config):

mock_config.return_value = FakeConfig()
mock_action.return_value = 0
mock_hash.return_value = 1
Expand All @@ -392,7 +379,6 @@ def test_get__hash_ids(mock_action, mock_hash, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_get')
def test_get__no_ids(mock_action, mock_api, mock_config, capsys):

mock_config.return_value = FakeConfig()
mock_action.return_value = None

Expand All @@ -409,7 +395,6 @@ def test_get__no_ids(mock_action, mock_api, mock_config, capsys):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_git_am__no_args(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()
mock_action.return_value = 0

Expand Down Expand Up @@ -439,7 +424,6 @@ def test_git_am__no_args(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_git_am__threeway_option(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()
mock_action.return_value = 0

Expand All @@ -454,7 +438,6 @@ def test_git_am__threeway_option(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_git_am__signoff_option(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()
mock_action.return_value = 0

Expand All @@ -470,7 +453,6 @@ def test_git_am__signoff_option(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_git_am__threeway_global_conf(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig(
{
'options': {
Expand All @@ -491,7 +473,6 @@ def test_git_am__threeway_global_conf(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_git_am__signoff_global_conf(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig(
{
'options': {
Expand All @@ -513,7 +494,6 @@ def test_git_am__signoff_global_conf(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_git_am__threeway_project_conf(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig(
{
DEFAULT_PROJECT: {
Expand All @@ -534,7 +514,6 @@ def test_git_am__threeway_project_conf(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_git_am__signoff_project_conf(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig(
{
DEFAULT_PROJECT: {
Expand All @@ -556,7 +535,6 @@ def test_git_am__signoff_project_conf(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_apply')
def test_git_am__failure(mock_action, mock_api, mock_config, capsys):

mock_config.return_value = FakeConfig()
mock_action.return_value = 1

Expand All @@ -578,7 +556,6 @@ def test_git_am__failure(mock_action, mock_api, mock_config, capsys):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_info')
def test_info(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()
mock_action.return_value = None

Expand Down Expand Up @@ -606,7 +583,6 @@ def test_info(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__no_options(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list'])
Expand All @@ -630,7 +606,6 @@ def test_list__no_options(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__state_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list', '-s', 'Accepted'])
Expand All @@ -654,7 +629,6 @@ def test_list__state_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__archived_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list', '-a', 'yes'])
Expand All @@ -678,7 +652,6 @@ def test_list__archived_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__project_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig(
{
'fakeproject': {
Expand Down Expand Up @@ -708,7 +681,6 @@ def test_list__project_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__submitter_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list', '-w', 'fakesubmitter'])
Expand All @@ -732,7 +704,6 @@ def test_list__submitter_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__delegate_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list', '-d', 'fakedelegate'])
Expand All @@ -756,7 +727,6 @@ def test_list__delegate_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__msgid_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list', '-m', 'fakemsgid'])
Expand All @@ -780,7 +750,6 @@ def test_list__msgid_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__name_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list', 'fake patch name'])
Expand All @@ -804,7 +773,6 @@ def test_list__name_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__limit_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list', '-n', '5'])
Expand All @@ -828,7 +796,6 @@ def test_list__limit_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__limit_reverse_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list', '-N', '5'])
Expand All @@ -852,7 +819,6 @@ def test_list__limit_reverse_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_list')
def test_list__hash_filter(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['list', '-H', '3143a71a9d33f4f12b4469818d205125cace6535'])
Expand All @@ -876,7 +842,6 @@ def test_list__hash_filter(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(projects, 'action_list')
def test_projects(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['projects'])
Expand All @@ -888,7 +853,6 @@ def test_projects(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(states, 'action_list')
def test_states(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig()

shell.main(['states'])
Expand All @@ -905,7 +869,6 @@ def test_update__no_options(
mock_config,
capsys,
):

mock_config.return_value = FakeConfig(
{
DEFAULT_PROJECT: {
Expand Down Expand Up @@ -933,7 +896,6 @@ def test_update__no_auth(
mock_config,
capsys,
):

mock_config.return_value = FakeConfig()

with pytest.raises(SystemExit):
Expand All @@ -949,7 +911,6 @@ def test_update__no_auth(
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_update')
def test_update__state_option(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig(
{
DEFAULT_PROJECT: {
Expand All @@ -974,7 +935,6 @@ def test_update__state_option(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_update')
def test_update__archive_option(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig(
{
DEFAULT_PROJECT: {
Expand All @@ -995,7 +955,6 @@ def test_update__archive_option(mock_action, mock_api, mock_config):
@mock.patch.object(api, 'XMLRPC')
@mock.patch.object(patches, 'action_update')
def test_update__commitref_option(mock_action, mock_api, mock_config):

mock_config.return_value = FakeConfig(
{
DEFAULT_PROJECT: {
Expand Down Expand Up @@ -1025,7 +984,6 @@ def test_update__commitref_with_multiple_patches(
mock_config,
capsys,
):

mock_config.return_value = FakeConfig(
{
DEFAULT_PROJECT: {
Expand All @@ -1048,7 +1006,6 @@ def test_update__commitref_with_multiple_patches(
@mock.patch.object(utils.configparser, 'ConfigParser')
@mock.patch.object(api, 'XMLRPC')
def test_view(mock_api, mock_config, mock_view, capsys):

fake_config = FakeConfig()

mock_config.return_value = fake_config
Expand Down
Loading

0 comments on commit 945f5ce

Please sign in to comment.