37
37
GETH_FIXTURE_ZIP = "geth-1.15.5-fixture.zip"
38
38
39
39
40
- @pytest .fixture ( scope = "module" )
40
+ @pytest .fixture
41
41
def geth_binary ():
42
42
from geth .install import (
43
43
get_executable_path ,
@@ -67,7 +67,7 @@ def absolute_datadir(directory_name):
67
67
)
68
68
69
69
70
- @pytest .fixture ( scope = "module" )
70
+ @pytest .fixture
71
71
def get_geth_version (geth_binary ):
72
72
from geth import (
73
73
get_geth_version ,
@@ -86,15 +86,15 @@ def get_geth_version(geth_binary):
86
86
return geth_version
87
87
88
88
89
- @pytest .fixture ( scope = "module" )
89
+ @pytest .fixture
90
90
def base_geth_command_arguments (geth_binary , datadir ):
91
91
return (
92
92
geth_binary ,
93
93
"--datadir" ,
94
94
datadir ,
95
95
"--dev" ,
96
96
"--dev.period" ,
97
- "2 " ,
97
+ "1 " ,
98
98
"--password" ,
99
99
os .path .join (datadir , "keystore" , "pw.txt" ),
100
100
# in order to raise on underpriced transactions, ``txpool.nolocals`` is now
@@ -103,15 +103,15 @@ def base_geth_command_arguments(geth_binary, datadir):
103
103
)
104
104
105
105
106
- @pytest .fixture ( scope = "module" )
106
+ @pytest .fixture
107
107
def geth_zipfile_version (get_geth_version ):
108
108
# TODO: Remove support for 1.13.x in next major version
109
109
if get_geth_version .major == 1 and get_geth_version .minor in [13 , 14 , 15 ]:
110
110
return GETH_FIXTURE_ZIP
111
111
raise AssertionError ("Unsupported geth version" )
112
112
113
113
114
- @pytest .fixture ( scope = "module" )
114
+ @pytest .fixture
115
115
def datadir (tmpdir_factory , geth_zipfile_version ):
116
116
zipfile_path = absolute_datadir (geth_zipfile_version )
117
117
base_dir = tmpdir_factory .mktemp ("goethereum" )
@@ -121,19 +121,19 @@ def datadir(tmpdir_factory, geth_zipfile_version):
121
121
return tmp_datadir
122
122
123
123
124
- @pytest .fixture ( scope = "module" )
124
+ @pytest .fixture
125
125
def geth_fixture_data (datadir ):
126
126
config_file_path = Path (datadir ) / "config.json"
127
127
return json .loads (config_file_path .read_text ())
128
128
129
129
130
- @pytest .fixture ( scope = "module" )
130
+ @pytest .fixture
131
131
def genesis_file (datadir ):
132
132
genesis_file_path = os .path .join (datadir , "genesis.json" )
133
133
return genesis_file_path
134
134
135
135
136
- @pytest .fixture ( scope = "module" )
136
+ @pytest .fixture
137
137
def geth_process (geth_binary , datadir , genesis_file , geth_command_arguments ):
138
138
init_datadir_command = (
139
139
geth_binary ,
@@ -165,100 +165,100 @@ def geth_process(geth_binary, datadir, genesis_file, geth_command_arguments):
165
165
)
166
166
167
167
168
- @pytest .fixture ( scope = "module" )
168
+ @pytest .fixture
169
169
def math_contract_deploy_txn_hash (geth_fixture_data ):
170
170
return geth_fixture_data ["math_deploy_txn_hash" ]
171
171
172
172
173
- @pytest .fixture ( scope = "module" )
173
+ @pytest .fixture
174
174
def math_contract (math_contract_factory , geth_fixture_data ):
175
175
return math_contract_factory (address = geth_fixture_data ["math_address" ])
176
176
177
177
178
- @pytest .fixture ( scope = "module" )
178
+ @pytest .fixture
179
179
def math_contract_address (math_contract , address_conversion_func ):
180
180
return address_conversion_func (math_contract .address )
181
181
182
182
183
- @pytest .fixture ( scope = "module" )
183
+ @pytest .fixture
184
184
def emitter_contract (emitter_contract_factory , geth_fixture_data ):
185
185
return emitter_contract_factory (address = geth_fixture_data ["emitter_address" ])
186
186
187
187
188
- @pytest .fixture ( scope = "module" )
188
+ @pytest .fixture
189
189
def emitter_contract_address (emitter_contract , address_conversion_func ):
190
190
return address_conversion_func (emitter_contract .address )
191
191
192
192
193
- @pytest .fixture ( scope = "module" )
193
+ @pytest .fixture
194
194
def keyfile_account_pkey (geth_fixture_data ):
195
195
return geth_fixture_data ["keyfile_account_pkey" ]
196
196
197
197
198
- @pytest .fixture ( scope = "module" )
198
+ @pytest .fixture
199
199
def keyfile_account_address (geth_fixture_data ):
200
200
return geth_fixture_data ["keyfile_account_address" ]
201
201
202
202
203
- @pytest .fixture ( scope = "module" )
203
+ @pytest .fixture
204
204
def keyfile_account_address_dual_type (keyfile_account_address , address_conversion_func ):
205
205
yield keyfile_account_address
206
206
207
207
208
- @pytest .fixture ( scope = "module" )
208
+ @pytest .fixture
209
209
def empty_block (w3 , geth_fixture_data ):
210
210
block = w3 .eth .get_block (geth_fixture_data ["empty_block_hash" ])
211
211
assert is_dict (block )
212
212
return block
213
213
214
214
215
- @pytest .fixture ( scope = "module" )
215
+ @pytest .fixture
216
216
def block_with_txn (w3 , geth_fixture_data ):
217
217
block = w3 .eth .get_block (geth_fixture_data ["block_with_txn_hash" ])
218
218
assert is_dict (block )
219
219
return block
220
220
221
221
222
- @pytest .fixture ( scope = "module" )
222
+ @pytest .fixture
223
223
def mined_txn_hash (geth_fixture_data ):
224
224
return geth_fixture_data ["mined_txn_hash" ]
225
225
226
226
227
- @pytest .fixture ( scope = "module" )
227
+ @pytest .fixture
228
228
def block_with_txn_with_log (w3 , geth_fixture_data ):
229
229
block = w3 .eth .get_block (geth_fixture_data ["block_hash_with_log" ])
230
230
assert is_dict (block )
231
231
return block
232
232
233
233
234
- @pytest .fixture ( scope = "module" )
234
+ @pytest .fixture
235
235
def txn_hash_with_log (geth_fixture_data ):
236
236
return geth_fixture_data ["txn_hash_with_log" ]
237
237
238
238
239
- @pytest .fixture ( scope = "module" )
239
+ @pytest .fixture
240
240
def block_hash_revert_no_msg (geth_fixture_data ):
241
241
return geth_fixture_data ["block_hash_revert_no_msg" ]
242
242
243
243
244
- @pytest .fixture ( scope = "module" )
244
+ @pytest .fixture
245
245
def block_hash_revert_with_msg (geth_fixture_data ):
246
246
return geth_fixture_data ["block_hash_revert_with_msg" ]
247
247
248
248
249
- @pytest .fixture ( scope = "module" )
249
+ @pytest .fixture
250
250
def revert_contract (revert_contract_factory , geth_fixture_data ):
251
251
return revert_contract_factory (address = geth_fixture_data ["revert_address" ])
252
252
253
253
254
- @pytest .fixture ( scope = "module" )
254
+ @pytest .fixture
255
255
def offchain_lookup_contract (offchain_lookup_contract_factory , geth_fixture_data ):
256
256
return offchain_lookup_contract_factory (
257
257
address = geth_fixture_data ["offchain_lookup_address" ]
258
258
)
259
259
260
260
261
- @pytest .fixture ( scope = "module" )
261
+ @pytest .fixture
262
262
def panic_errors_contract (
263
263
w3 ,
264
264
geth_fixture_data ,
@@ -267,7 +267,7 @@ def panic_errors_contract(
267
267
return contract_factory (address = geth_fixture_data ["panic_errors_contract_address" ])
268
268
269
269
270
- @pytest .fixture ( scope = "module" )
270
+ @pytest .fixture
271
271
def storage_contract (
272
272
w3 ,
273
273
geth_fixture_data ,
@@ -279,19 +279,19 @@ def storage_contract(
279
279
# --- async --- #
280
280
281
281
282
- @pytest_asyncio .fixture ( scope = "module" )
282
+ @pytest_asyncio .fixture
283
283
async def async_keyfile_account_address (geth_fixture_data ):
284
284
return geth_fixture_data ["keyfile_account_address" ]
285
285
286
286
287
- @pytest_asyncio .fixture ( scope = "module" )
287
+ @pytest_asyncio .fixture
288
288
async def async_keyfile_account_address_dual_type (
289
289
async_keyfile_account_address , address_conversion_func
290
290
):
291
291
yield async_keyfile_account_address
292
292
293
293
294
- @pytest .fixture ( scope = "module" )
294
+ @pytest .fixture
295
295
def async_offchain_lookup_contract (
296
296
async_offchain_lookup_contract_factory , geth_fixture_data
297
297
):
@@ -300,7 +300,7 @@ def async_offchain_lookup_contract(
300
300
)
301
301
302
302
303
- @pytest .fixture ( scope = "module" )
303
+ @pytest .fixture
304
304
def async_panic_errors_contract (
305
305
async_w3 ,
306
306
geth_fixture_data ,
@@ -309,35 +309,35 @@ def async_panic_errors_contract(
309
309
return contract_factory (address = geth_fixture_data ["panic_errors_contract_address" ])
310
310
311
311
312
- @pytest .fixture ( scope = "module" )
312
+ @pytest .fixture
313
313
def async_emitter_contract (async_w3 , geth_fixture_data ):
314
314
contract_factory = async_w3 .eth .contract (** EMITTER_CONTRACT_DATA )
315
315
return contract_factory (address = geth_fixture_data ["emitter_address" ])
316
316
317
317
318
- @pytest .fixture ( scope = "module" )
318
+ @pytest .fixture
319
319
def async_emitter_contract_address (async_emitter_contract , address_conversion_func ):
320
320
return address_conversion_func (async_emitter_contract .address )
321
321
322
322
323
- @pytest .fixture ( scope = "module" )
323
+ @pytest .fixture
324
324
def async_math_contract (async_w3 , geth_fixture_data ):
325
325
contract_factory = async_w3 .eth .contract (** MATH_CONTRACT_DATA )
326
326
return contract_factory (address = geth_fixture_data ["math_address" ])
327
327
328
328
329
- @pytest .fixture ( scope = "module" )
329
+ @pytest .fixture
330
330
def async_math_contract_address (async_math_contract , address_conversion_func ):
331
331
return address_conversion_func (async_math_contract .address )
332
332
333
333
334
- @pytest .fixture ( scope = "module" )
334
+ @pytest .fixture
335
335
def async_revert_contract (async_w3 , geth_fixture_data ):
336
336
contract_factory = async_w3 .eth .contract (** REVERT_CONTRACT_DATA )
337
337
return contract_factory (address = geth_fixture_data ["revert_address" ])
338
338
339
339
340
- @pytest .fixture ( scope = "module" )
340
+ @pytest .fixture
341
341
def async_storage_contract (
342
342
async_w3 ,
343
343
geth_fixture_data ,
@@ -346,21 +346,21 @@ def async_storage_contract(
346
346
return contract_factory (address = geth_fixture_data ["storage_contract_address" ])
347
347
348
348
349
- @pytest_asyncio .fixture ( scope = "module" )
349
+ @pytest_asyncio .fixture
350
350
async def async_empty_block (async_w3 , geth_fixture_data ):
351
351
block = await async_w3 .eth .get_block (geth_fixture_data ["empty_block_hash" ])
352
352
assert is_dict (block )
353
353
return block
354
354
355
355
356
- @pytest_asyncio .fixture ( scope = "module" )
356
+ @pytest_asyncio .fixture
357
357
async def async_block_with_txn (async_w3 , geth_fixture_data ):
358
358
block = await async_w3 .eth .get_block (geth_fixture_data ["block_with_txn_hash" ])
359
359
assert is_dict (block )
360
360
return block
361
361
362
362
363
- @pytest_asyncio .fixture ( scope = "module" )
363
+ @pytest_asyncio .fixture
364
364
async def async_block_with_txn_with_log (async_w3 , geth_fixture_data ):
365
365
block = await async_w3 .eth .get_block (geth_fixture_data ["block_hash_with_log" ])
366
366
assert is_dict (block )
0 commit comments