@@ -108,7 +108,7 @@ def run_test(self, input_path: str, output_path: str, *, inplace: bool):
108
108
assert actual == expected
109
109
110
110
111
- @pytest .fixture
111
+ @pytest .fixture ( scope = 'session' )
112
112
def solana_test_validator ():
113
113
114
114
ledger_dir = mkdtemp (prefix = 'stv_' )
@@ -129,31 +129,35 @@ def solana_test_validator():
129
129
rmtree (ledger_dir )
130
130
131
131
132
- @pytest .fixture
132
+ @pytest .fixture ( scope = 'session' )
133
133
def solana_keygen ():
134
134
135
- cmd = ['solana-keygen' , 'new' , '--no-passphrase' ]
135
+ cfg_dir = mkdtemp (prefix = 'cfg_' )
136
+ path = os .path .join (cfg_dir , 'id.json' )
137
+ cmd = ['solana-keygen' , 'new' , '--no-passphrase' , '--outfile' , path ]
136
138
output = check_output (cmd )
137
139
output = output .decode ('ascii' )
138
140
output = output .splitlines ()
139
141
output = [line for line in output if 'pubkey' in line ][0 ]
140
142
output = output .split ('pubkey: ' )[1 ]
141
- return output
143
+ yield (output , path )
144
+ rmtree (cfg_dir )
142
145
143
146
144
- @pytest .fixture
147
+ @pytest .fixture ( scope = 'session' )
145
148
def solana_airdrop (solana_test_validator , solana_keygen ):
146
149
147
150
cmd = [
148
- 'solana' , 'airdrop' , '100' , solana_keygen ,
151
+ 'solana' , 'airdrop' , '100' , solana_keygen [ 0 ] ,
149
152
'--commitment' , 'finalized' ,
150
153
'--url' , 'localhost' ,
154
+ '--keypair' , solana_keygen [1 ],
151
155
]
152
156
check_call (cmd )
153
157
154
158
155
- @pytest .fixture
156
- def solana_program_deploy (solana_test_validator , solana_airdrop ):
159
+ @pytest .fixture ( scope = 'session' )
160
+ def solana_program_deploy (solana_test_validator , solana_keygen , solana_airdrop ):
157
161
158
162
cmd = [
159
163
'solana' , 'program' , 'deploy' ,
@@ -162,6 +166,7 @@ def solana_program_deploy(solana_test_validator, solana_airdrop):
162
166
),
163
167
'--commitment' , 'finalized' ,
164
168
'--url' , 'localhost' ,
169
+ '--keypair' , solana_keygen [1 ],
165
170
]
166
171
output = check_output (cmd )
167
172
output = output .decode ('ascii' )
0 commit comments