Skip to content

Commit 0a698df

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c0e43b6 commit 0a698df

23 files changed

+313
-221
lines changed

robottelo/hosts.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,10 +2660,14 @@ def generate_inventory_report(self, org, disconnected='false'):
26602660
data={'disconnected': disconnected}
26612661
)
26622662
wait_for(
2663-
lambda: self.api.ForemanTask()
2664-
.search(query={'search': f'{generate_report_task} and started_at >= "{timestamp}"'})[0]
2665-
.result
2666-
== 'success',
2663+
lambda: (
2664+
self.api.ForemanTask()
2665+
.search(
2666+
query={'search': f'{generate_report_task} and started_at >= "{timestamp}"'}
2667+
)[0]
2668+
.result
2669+
== 'success'
2670+
),
26672671
timeout=400,
26682672
delay=15,
26692673
silent_failure=True,
@@ -2674,10 +2678,12 @@ def sync_inventory_status(self, org):
26742678
"""Perform inventory sync"""
26752679
inventory_sync = self.api.Organization(id=org.id).rh_cloud_inventory_sync()
26762680
wait_for(
2677-
lambda: self.api.ForemanTask()
2678-
.search(query={'search': f'id = {inventory_sync["task"]["id"]}'})[0]
2679-
.result
2680-
== 'success',
2681+
lambda: (
2682+
self.api.ForemanTask()
2683+
.search(query={'search': f'id = {inventory_sync["task"]["id"]}'})[0]
2684+
.result
2685+
== 'success'
2686+
),
26812687
timeout=400,
26822688
delay=15,
26832689
silent_failure=True,

tests/foreman/api/test_discoveredhost.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,14 @@ def _assert_discovered_host(host, channel=None, user_config=None):
123123
default_config = entity_mixins.DEFAULT_SERVER_CONFIG
124124
try:
125125
wait_for(
126-
lambda: len(
127-
host.api.DiscoveredHost(user_config or default_config).search(
128-
query={'search': f'name={host.guest_name}'}
126+
lambda: (
127+
len(
128+
host.api.DiscoveredHost(user_config or default_config).search(
129+
query={'search': f'name={host.guest_name}'}
130+
)
129131
)
130-
)
131-
> 0,
132+
> 0
133+
),
132134
timeout=20,
133135
delay=2,
134136
logger=logger,

tests/foreman/api/test_subscription.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,12 @@ def parse(events):
289289
# Wait for candlepin to process the manifest upload events
290290
# Use polling instead of fixed sleep to avoid flakiness
291291
wait_for(
292-
lambda: parse(
293-
target_sat.api.Ping().search_json()['services']['candlepin_events']['message']
294-
)['Processed']
295-
> pre_processed_count,
292+
lambda: (
293+
parse(target_sat.api.Ping().search_json()['services']['candlepin_events']['message'])[
294+
'Processed'
295+
]
296+
> pre_processed_count
297+
),
296298
timeout=60,
297299
delay=5,
298300
handle_exception=True,

tests/foreman/cli/test_ansible.py

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -886,13 +886,15 @@ def test_positive_ansible_dynamic_inventory(
886886
)
887887
assert sync_response.ok
888888
wait_for(
889-
lambda: rhel_contenthost.hostname
890-
in [
891-
host['name']
892-
for host in aap_client.get(
893-
f'{api_base}inventories/{inv_list["results"][0]["id"]}/hosts/?search={rhel_contenthost.hostname}'
894-
).json()['results']
895-
],
889+
lambda: (
890+
rhel_contenthost.hostname
891+
in [
892+
host['name']
893+
for host in aap_client.get(
894+
f'{api_base}inventories/{inv_list["results"][0]["id"]}/hosts/?search={rhel_contenthost.hostname}'
895+
).json()['results']
896+
]
897+
),
896898
timeout=180,
897899
delay=30,
898900
)
@@ -1003,8 +1005,10 @@ def test_positive_ansible_provisioning_callback(
10031005
# Host should do call back to the Satellite reporting
10041006
# the result of the installation. Wait until Satellite reports that the host is installed.
10051007
wait_for(
1006-
lambda: sat.cli.Host.info({'name': hostname})['status']['build-status']
1007-
!= 'Pending installation',
1008+
lambda: (
1009+
sat.cli.Host.info({'name': hostname})['status']['build-status']
1010+
!= 'Pending installation'
1011+
),
10081012
timeout=1800,
10091013
delay=30,
10101014
)
@@ -1038,13 +1042,15 @@ def test_positive_ansible_provisioning_callback(
10381042
assert sync_response.ok
10391043

10401044
wait_for(
1041-
lambda: hostname
1042-
in [
1043-
host['name']
1044-
for host in aap_client.get(
1045-
f'{api_base}inventories/{inv_list["results"][0]["id"]}/hosts/?search={hostname}'
1046-
).json()['results']
1047-
],
1045+
lambda: (
1046+
hostname
1047+
in [
1048+
host['name']
1049+
for host in aap_client.get(
1050+
f'{api_base}inventories/{inv_list["results"][0]["id"]}/hosts/?search={hostname}'
1051+
).json()['results']
1052+
]
1053+
),
10481054
timeout=180,
10491055
delay=30,
10501056
)
@@ -1060,10 +1066,10 @@ def test_positive_ansible_provisioning_callback(
10601066
# when the callback service is started, the job sometimes starts with pending or waiting state before going to the running state
10611067
filtered_job = jobs['id'] if jobs['status'] in ('running', 'pending', 'waiting') else None
10621068
wait_for(
1063-
lambda: aap_client.get(f'{api_base}jobs/?id={filtered_job}').json()['results'][0][
1064-
'status'
1065-
]
1066-
== 'successful',
1069+
lambda: (
1070+
aap_client.get(f'{api_base}jobs/?id={filtered_job}').json()['results'][0]['status']
1071+
== 'successful'
1072+
),
10671073
timeout=120,
10681074
)
10691075
# Verify user rocket and package tmux is installed via ansible-callback on provisioning host

tests/foreman/cli/test_artifacts.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,17 @@ def test_positive_artifact_repair(
116116
repo=module_synced_content.repo.label,
117117
)
118118
wait_for(
119-
lambda: len(
120-
get_repo_files_urls_by_url(
121-
sat_repo_url,
122-
extension='rpm' if module_synced_content.repo.content_type == 'yum' else 'iso',
119+
lambda: (
120+
len(
121+
get_repo_files_urls_by_url(
122+
sat_repo_url,
123+
extension='rpm'
124+
if module_synced_content.repo.content_type == 'yum'
125+
else 'iso',
126+
)
123127
)
124-
)
125-
> 0,
128+
> 0
129+
),
126130
timeout=120,
127131
delay=15,
128132
)

tests/foreman/cli/test_computeresource_vmware.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ def test_positive_provision_end_to_end(
142142
# check if vm is created on vmware
143143
assert vmwareclient.does_vm_exist(hostname) is True
144144
wait_for(
145-
lambda: sat.cli.Host.info({'name': hostname})['status']['build-status']
146-
!= 'Pending installation',
145+
lambda: (
146+
sat.cli.Host.info({'name': hostname})['status']['build-status']
147+
!= 'Pending installation'
148+
),
147149
timeout=1800,
148150
delay=30,
149151
)
@@ -234,8 +236,10 @@ def test_positive_image_provision_end_to_end(
234236
assert 'VirtualTPM' in vm.get_virtual_device_type_names()
235237

236238
wait_for(
237-
lambda: sat.cli.Host.info({'name': hostname})['status']['build-status']
238-
!= 'Pending installation',
239+
lambda: (
240+
sat.cli.Host.info({'name': hostname})['status']['build-status']
241+
!= 'Pending installation'
242+
),
239243
timeout=1800,
240244
delay=30,
241245
)

tests/foreman/cli/test_discoveredhost.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ def test_rhel_pxe_discovery_provisioning(
5555
org = provisioning_hostgroup.organization[0].read()
5656
loc = provisioning_hostgroup.location[0].read()
5757
wait_for(
58-
lambda: sat.api.DiscoveredHost().search(
59-
query={
60-
'mac': mac,
61-
}
62-
)
63-
!= [],
58+
lambda: (
59+
sat.api.DiscoveredHost().search(
60+
query={
61+
'mac': mac,
62+
}
63+
)
64+
!= []
65+
),
6466
timeout=1500,
6567
delay=20,
6668
)
@@ -143,12 +145,14 @@ def test_rhel_pxeless_discovery_provisioning(
143145
org = provisioning_hostgroup.organization[0].read()
144146
loc = provisioning_hostgroup.location[0].read()
145147
wait_for(
146-
lambda: sat.api.DiscoveredHost().search(
147-
query={
148-
'mac': mac,
149-
}
150-
)
151-
!= [],
148+
lambda: (
149+
sat.api.DiscoveredHost().search(
150+
query={
151+
'mac': mac,
152+
}
153+
)
154+
!= []
155+
),
152156
timeout=1500,
153157
delay=40,
154158
)

tests/foreman/cli/test_host.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,12 +1732,14 @@ def test_positive_erratum_applicability(
17321732
# Verify that the applied erratum is no longer in applicable errata list
17331733
try:
17341734
applicable_erratum, _ = wait_for(
1735-
lambda: security_errata
1736-
not in [
1737-
errata['erratum-id']
1738-
for errata in target_sat.cli.Host.errata_list({'host-id': host_info['id']})
1739-
if errata['installable'] == 'true'
1740-
],
1735+
lambda: (
1736+
security_errata
1737+
not in [
1738+
errata['erratum-id']
1739+
for errata in target_sat.cli.Host.errata_list({'host-id': host_info['id']})
1740+
if errata['installable'] == 'true'
1741+
]
1742+
),
17411743
handle_exception=True,
17421744
timeout=300,
17431745
delay=5,

tests/foreman/cli/test_leapp_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
{'source_version': RHEL8_VER, 'target_version': RHEL9_VER},
2929
{'source_version': RHEL9_VER, 'target_version': RHEL10_VER},
3030
],
31-
ids=lambda upgrade_path: f'{upgrade_path["source_version"]}'
32-
f'_to_{upgrade_path["target_version"]}',
31+
ids=lambda upgrade_path: (
32+
f'{upgrade_path["source_version"]}_to_{upgrade_path["target_version"]}'
33+
),
3334
)
3435
@pytest.mark.parametrize('auth_type', ['admin', 'non-admin'])
3536
def test_positive_leapp_upgrade_rhel(
@@ -114,8 +115,9 @@ def test_positive_leapp_upgrade_rhel(
114115
[
115116
{'source_version': RHEL8_VER, 'target_version': RHEL9_VER},
116117
],
117-
ids=lambda upgrade_path: f'{upgrade_path["source_version"]}'
118-
f'_to_{upgrade_path["target_version"]}',
118+
ids=lambda upgrade_path: (
119+
f'{upgrade_path["source_version"]}_to_{upgrade_path["target_version"]}'
120+
),
119121
)
120122
@pytest.mark.parametrize(
121123
'setting_update',

tests/foreman/cli/test_remoteexecution.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -959,12 +959,14 @@ def test_recurring_with_unreachable_host(self, module_target_sat, rhel_contentho
959959
)
960960
# wait for the third task to be planned which verifies the BZ
961961
wait_for(
962-
lambda: int(
963-
cli.RecurringLogic.info(
964-
{'id': cli.JobInvocation.info({'id': invocation.id})['recurring-logic-id']}
965-
)['task-count']
966-
)
967-
> 2,
962+
lambda: (
963+
int(
964+
cli.RecurringLogic.info(
965+
{'id': cli.JobInvocation.info({'id': invocation.id})['recurring-logic-id']}
966+
)['task-count']
967+
)
968+
> 2
969+
),
968970
timeout=180,
969971
delay=10,
970972
)

0 commit comments

Comments
 (0)