1
- import json
2
1
import os
3
2
import pytest
4
3
import shutil
29
28
30
29
KEYFILE_PW = 'web3py-test'
31
30
32
- PARITY_FIXTURE = {
31
+ PARITY_1_8_8_FIXTURE = {
32
+ 'datadir' : 'parity-188-fixture' ,
33
+ 'coinbase' : 'dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd' ,
34
+ 'block_hash_with_log' : '0x342e12ab6d24d7fb1d774a6b47cd2cc04430a3295bee5662d5a1a0b766480031' ,
35
+ 'block_with_txn_hash' : '0xa866266a5a348948c38855cc6e990093b35a3d2c43fdddfe3b1259c9c3fc7404' ,
36
+ 'emitter_address' : '0x4aA591a07989b4F810E2F5cE97e769D60710f168' ,
37
+ 'emitter_deploy_txn_hash' : '0xa81e903e9953758c8da5aaae66451ff909edd7bd6aefc3ebeab1e709e3229bcc' ,
38
+ 'empty_block_hash' : '0xbcb2826e4376c23e66750607af72965f177f93b39e5024be259e6b0ff4f95e9d' ,
39
+ 'keyfile_pw' : 'web3py-test' ,
40
+ 'math_address' : '0xd794C821fCCFF5D96F5Db44af7e29977630A9dc2' ,
41
+ 'math_deploy_txn_hash' : '0x03cc47c8f58608576187825aed01c4fc64786f1172d182d432336881a75a0fa3' ,
42
+ 'mined_txn_hash' : '0x9839fde5fce7f0ed29b49a687d4f7630076069e65c2e1df87ffab9b2844d3899' ,
43
+ 'raw_txn_account' : '0x39EEed73fb1D3855E90Cbd42f348b3D7b340aAA6' ,
44
+ 'txn_hash_with_log' : '0x26bad3318b3466833f96d04ac9ba46fbbce11c15be2f83c9fe0b5dc15b2646cd'
45
+ }
46
+
47
+ PARITY_1_8_7_FIXTURE = {
33
48
'datadir' : 'parity-187-fixture' ,
49
+ 'coinbase' : 'dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd' ,
34
50
'block_hash_with_log' : '0x342e12ab6d24d7fb1d774a6b47cd2cc04430a3295bee5662d5a1a0b766480031' ,
35
51
'block_with_txn_hash' : '0xa866266a5a348948c38855cc6e990093b35a3d2c43fdddfe3b1259c9c3fc7404' ,
36
52
'emitter_address' : '0x4aA591a07989b4F810E2F5cE97e769D60710f168' ,
@@ -66,7 +82,12 @@ def get_parity_version(parity_binary):
66
82
67
83
@pytest .fixture (scope = "session" )
68
84
def parity_fixture_data (parity_binary ):
69
- return PARITY_FIXTURE
85
+ if os .path .basename (parity_binary ) == 'parity-1_8_7' :
86
+ return PARITY_1_8_7_FIXTURE
87
+ elif os .path .basename (parity_binary ) == 'parity-1_8_8' :
88
+ return PARITY_1_8_7_FIXTURE
89
+ else :
90
+ return PARITY_1_8_7_FIXTURE
70
91
71
92
72
93
@pytest .fixture (scope = 'session' )
@@ -82,13 +103,10 @@ def datadir(tmpdir_factory, parity_fixture_data):
82
103
83
104
84
105
@pytest .fixture (scope = "session" )
85
- def accounts ( datadir ):
106
+ def author ( parity_fixture_data ):
86
107
# need the address to unlock before web3 session has been opened
87
- chain_config_path = os .path .join (datadir , "chain_config.json" )
88
- with open (chain_config_path , 'r' ) as f :
89
- chain_config = json .load (f )
90
- accounts = chain_config ['accounts' ].keys ()
91
- return accounts
108
+ author = parity_fixture_data ['coinbase' ]
109
+ return author
92
110
93
111
94
112
@pytest .fixture (scope = 'session' )
@@ -133,15 +151,14 @@ def parity_process(
133
151
parity_binary ,
134
152
ipc_path , datadir ,
135
153
passwordfile ,
136
- accounts ):
137
- coinbase = list (accounts )[0 ]
154
+ author ):
138
155
139
156
run_parity_command = (
140
157
parity_binary ,
141
158
'--chain' , os .path .join (datadir , 'chain_config.json' ),
142
159
'--ipc-path' , ipc_path ,
143
160
'--base-path' , str (datadir ),
144
- '--unlock' , coinbase ,
161
+ '--unlock' , str ( author ) ,
145
162
'--password' , str (passwordfile ),
146
163
)
147
164
proc = subprocess .Popen (
@@ -167,16 +184,14 @@ def parity_process(
167
184
168
185
169
186
@pytest .fixture (scope = "session" )
170
- def parity_import_blocks_process (parity_binary , ipc_path , datadir , passwordfile , accounts ):
171
- coinbase = list (accounts )[0 ]
172
-
187
+ def parity_import_blocks_process (parity_binary , ipc_path , datadir , passwordfile ):
173
188
run_parity_command = (
174
189
parity_binary ,
175
190
'import' , os .path .join (datadir , 'blocks_export.rlp' ),
176
191
'--chain' , os .path .join (datadir , 'chain_config.json' ),
177
192
'--ipc-path' , ipc_path ,
178
193
'--base-path' , str (datadir ),
179
- '--unlock' , coinbase ,
194
+ '--unlock' , str ( author ) ,
180
195
'--password' , str (passwordfile ),
181
196
)
182
197
proc = subprocess .Popen (
0 commit comments