15
15
16
16
__metaclass__ = type
17
17
18
+ import tempfile
18
19
import ansible .constants
19
20
import ansible .errors
20
21
import ansible .utils
21
22
import pytest
22
- from pprint import pprint
23
23
from shellescape import quote
24
- import tempfile
25
24
26
25
from ibm_zos_core .tests .helpers .dataset import get_tmp_ds_name
27
26
@@ -51,19 +50,19 @@ def test_zos_job_query_func(ansible_zos_module):
51
50
def test_zos_job_id_query_multi_wildcards_func (ansible_zos_module ):
52
51
try :
53
52
hosts = ansible_zos_module
54
- JDATA_SET_NAME = get_tmp_ds_name ()
53
+ jdata_set_name = get_tmp_ds_name ()
55
54
hosts .all .file (path = TEMP_PATH , state = "directory" )
56
55
hosts .all .shell (
57
- cmd = "echo {0 } > {1 }/SAMPLE" . format ( quote ( JCLQ_FILE_CONTENTS ), TEMP_PATH )
56
+ cmd = f "echo { quote ( JCLQ_FILE_CONTENTS ) } > { TEMP_PATH } /SAMPLE"
58
57
)
59
58
hosts .all .zos_data_set (
60
- name = JDATA_SET_NAME , state = "present" , type = "pds" , replace = True
59
+ name = jdata_set_name , state = "present" , type = "pds" , replace = True
61
60
)
62
61
hosts .all .shell (
63
- cmd = "cp {0 }/SAMPLE \" //'{1 }(SAMPLE)'\" " . format ( TEMP_PATH , JDATA_SET_NAME )
62
+ cmd = f "cp { TEMP_PATH } /SAMPLE \" //'{ jdata_set_name } (SAMPLE)'\" "
64
63
)
65
64
results = hosts .all .zos_job_submit (
66
- src = "{0 }(SAMPLE)". format ( JDATA_SET_NAME ) , location = "data_set" , wait_time_s = 10
65
+ src = f" { jdata_set_name } (SAMPLE)" , location = "data_set" , wait_time_s = 10
67
66
)
68
67
for result in results .contacted .values ():
69
68
assert result .get ("jobs" )[0 ].get ("ret_code" ).get ("msg_code" ) == "0000"
@@ -77,26 +76,26 @@ def test_zos_job_id_query_multi_wildcards_func(ansible_zos_module):
77
76
78
77
finally :
79
78
hosts .all .file (path = TEMP_PATH , state = "absent" )
80
- hosts .all .zos_data_set (name = JDATA_SET_NAME , state = "absent" )
79
+ hosts .all .zos_data_set (name = jdata_set_name , state = "absent" )
81
80
82
81
83
82
# test to show multi wildcard in Job_name query won't crash the search
84
83
def test_zos_job_name_query_multi_wildcards_func (ansible_zos_module ):
85
84
try :
86
85
hosts = ansible_zos_module
87
- NDATA_SET_NAME = get_tmp_ds_name ()
86
+ ndata_set_name = get_tmp_ds_name ()
88
87
hosts .all .file (path = TEMP_PATH , state = "directory" )
89
88
hosts .all .shell (
90
- cmd = "echo {0 } > {1 }/SAMPLE" . format ( quote ( JCLQ_FILE_CONTENTS ), TEMP_PATH )
89
+ cmd = f "echo { quote ( JCLQ_FILE_CONTENTS ) } > { TEMP_PATH } /SAMPLE"
91
90
)
92
91
hosts .all .zos_data_set (
93
- name = NDATA_SET_NAME , state = "present" , type = "pds" , replace = True
92
+ name = ndata_set_name , state = "present" , type = "pds" , replace = True
94
93
)
95
94
hosts .all .shell (
96
- cmd = "cp {0 }/SAMPLE \" //'{1 }(SAMPLE)'\" " . format ( TEMP_PATH , NDATA_SET_NAME )
95
+ cmd = f "cp { TEMP_PATH } /SAMPLE \" //'{ ndata_set_name } (SAMPLE)'\" "
97
96
)
98
97
results = hosts .all .zos_job_submit (
99
- src = "{0 }(SAMPLE)". format ( NDATA_SET_NAME ) , location = "data_set" , wait_time_s = 10
98
+ src = f" { ndata_set_name } (SAMPLE)" , location = "data_set" , wait_time_s = 10
100
99
)
101
100
for result in results .contacted .values ():
102
101
assert result .get ("jobs" )[0 ].get ("ret_code" ).get ("msg_code" ) == "0000"
@@ -109,7 +108,7 @@ def test_zos_job_name_query_multi_wildcards_func(ansible_zos_module):
109
108
110
109
finally :
111
110
hosts .all .file (path = TEMP_PATH , state = "absent" )
112
- hosts .all .zos_data_set (name = NDATA_SET_NAME , state = "absent" )
111
+ hosts .all .zos_data_set (name = ndata_set_name , state = "absent" )
113
112
114
113
115
114
def test_zos_job_id_query_short_ids_func (ansible_zos_module ):
0 commit comments