minor changes
This commit is contained in:
parent
a7126ede03
commit
122ac43573
7 changed files with 31 additions and 14 deletions
|
|
@ -724,8 +724,9 @@ class MMGenLabel(str,Hilite,InitErrors):
|
|||
# Allow: (L)etter,(N)umber,(P)unctuation,(S)ymbol,(Z)space
|
||||
# Disallow: (C)ontrol,(M)combining
|
||||
# Combining characters create width formatting issues, so disallow them for now
|
||||
assert unicodedata.category(ch)[0] not in 'CM','{!r}: {} characters not allowed'.format(
|
||||
ch,('control','combining')[unicodedata.category(ch)[0]=='M'])
|
||||
if unicodedata.category(ch)[0] in 'CM':
|
||||
t = { 'C':'control', 'M':'combining' }[unicodedata.category(ch)[0]]
|
||||
raise ValueError('{}: {} characters not allowed'.format(ascii(ch),t))
|
||||
assert len(s) <= cls.max_len, 'too long (>{} symbols)'.format(cls.max_len)
|
||||
assert len(s) >= cls.min_len, 'too short (<{} symbols)'.format(cls.min_len)
|
||||
assert not cls.allowed or set(list(s)).issubset(set(cls.allowed)),\
|
||||
|
|
|
|||
|
|
@ -781,7 +781,7 @@ class Brainwallet (SeedSourceEnc):
|
|||
seed_len = opt.seed_len
|
||||
qmsg_r('Hashing brainwallet data. Please wait...')
|
||||
# Use buflen arg of scrypt.hash() to get seed of desired length
|
||||
seed = scrypt_hash_passphrase(self.brainpasswd,'',d.hash_preset,buflen=seed_len//8)
|
||||
seed = scrypt_hash_passphrase(self.brainpasswd.encode(),b'',d.hash_preset,buflen=seed_len//8)
|
||||
qmsg('Done')
|
||||
self.seed = Seed(seed)
|
||||
msg('Seed ID: {}'.format(self.seed.sid))
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ class MMGenPexpect(object):
|
|||
|
||||
self.req_exit_val = 0
|
||||
self.skip_ok = False
|
||||
self.timeout = int(opt.pexpect_timeout or 0) or (60,5)[bool(opt.debug_pexpect)]
|
||||
self.sent_value = None
|
||||
|
||||
def do_decrypt_ka_data(self,hp,pw,desc='key-address data',check=True,have_yes_opt=False):
|
||||
# self.hash_preset(desc,hp)
|
||||
|
|
@ -170,8 +172,7 @@ class MMGenPexpect(object):
|
|||
|
||||
if not silent:
|
||||
if opt.verbose:
|
||||
quo = ('',"'")[type(s) == str]
|
||||
msg_r('EXPECT {}'.format(yellow(quo+str(s)+quo)))
|
||||
msg_r('EXPECT ' + yellow(str(s)))
|
||||
elif not opt.exact_output: msg_r('+')
|
||||
|
||||
try:
|
||||
|
|
@ -179,11 +180,13 @@ class MMGenPexpect(object):
|
|||
ret = 0
|
||||
else:
|
||||
f = (self.p.expect_exact,self.p.expect)[bool(regex)]
|
||||
ret = f(s,timeout=(60,5)[bool(opt.debug_pexpect)])
|
||||
ret = f(s,self.timeout)
|
||||
except pexpect.TIMEOUT:
|
||||
if opt.debug_pexpect: raise
|
||||
quo = ('',"'")[type(s) == str]
|
||||
rdie(1,red('\nERROR. Expect {}{}{} timed out. Exiting'.format(quo,s,quo)))
|
||||
m1 = red('\nERROR. Expect {!r} timed out. Exiting\n'.format(s))
|
||||
m2 = 'before: [{}]\n'.format(self.p.before)
|
||||
m3 = 'sent value: [{}]'.format(self.sent_value) if self.sent_value != None else ''
|
||||
rdie(1,m1+m2+m3)
|
||||
|
||||
debug_pexpect_msg(self.p)
|
||||
|
||||
|
|
@ -200,9 +203,12 @@ class MMGenPexpect(object):
|
|||
return ret
|
||||
|
||||
def send(self,t,delay=None,s=False):
|
||||
self.sent_value = None
|
||||
delay = delay or (0,0.3)[bool(opt.buf_keypress)]
|
||||
if delay: time.sleep(delay)
|
||||
ret = self.p.send(t) # returns num bytes written
|
||||
if ret:
|
||||
self.sent_value = t
|
||||
if delay: time.sleep(delay)
|
||||
if opt.verbose:
|
||||
ls = (' ','')[bool(opt.debug or not s)]
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ opts_data = lambda: {
|
|||
-S, --skip-deps Skip dependency checking for command
|
||||
-u, --usr-random Get random data interactively from user
|
||||
-t, --traceback Run the command inside the '{tbc}' script
|
||||
-T, --pexpect-timeout=T Set the timeout for pexpect
|
||||
-v, --verbose Produce more verbose output
|
||||
-W, --no-dw-delete Don't remove default wallet from data dir after dw tests are done
|
||||
-X, --exit-after=C Exit after command 'C'
|
||||
|
|
|
|||
|
|
@ -44,9 +44,13 @@ parity_pid_fn = 'parity.pid'
|
|||
parity_key_fn = 'parity.devkey'
|
||||
|
||||
# Token sends require varying amounts of gas, depending on compiler version
|
||||
solc_ver = re.search(r'Version:\s*(.*)',
|
||||
subprocess.Popen(['solc','--version'],stdout=subprocess.PIPE
|
||||
).stdout.read().decode()).group(1)
|
||||
try:
|
||||
solc_ver = re.search(r'Version:\s*(.*)',
|
||||
subprocess.Popen(['solc','--version'],stdout=subprocess.PIPE
|
||||
).stdout.read().decode()).group(1)
|
||||
except:
|
||||
solc_ver = ''
|
||||
|
||||
|
||||
if re.match(r'\b0.5.1\b',solc_ver): # Raspbian Stretch
|
||||
vbal1 = '1.2288337'
|
||||
|
|
@ -58,6 +62,8 @@ elif re.match(r'\b0.5.3\b',solc_ver): # Ubuntu Bionic
|
|||
vbal2 = '99.997092733'
|
||||
vbal3 = '1.23142915'
|
||||
vbal4 = '127.0287987'
|
||||
else:
|
||||
vbal1 = vbal2 = vbal3 = vbal4 = None
|
||||
|
||||
bals = {
|
||||
'1': [ ('98831F3A:E:1','123.456')],
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ class TestSuiteMain(TestSuiteBase,TestSuiteShared):
|
|||
t.written_to_file('Transaction')
|
||||
os.unlink(txfile) # our tx file replaces the original
|
||||
cmd = 'touch ' + joinpath(self.tmpdir,'txbump')
|
||||
os.system(cmd.encode())
|
||||
os.system(cmd)
|
||||
return t
|
||||
|
||||
def txsend(self,sigfile,bogus_send=True,extra_opts=[]):
|
||||
|
|
@ -656,7 +656,7 @@ class TestSuiteMain(TestSuiteBase,TestSuiteShared):
|
|||
self.txsend_ui_common(t)
|
||||
|
||||
cmd = 'touch ' + joinpath(self.tmpdir,'txdo')
|
||||
os.system(cmd.encode())
|
||||
os.system(cmd)
|
||||
return t
|
||||
|
||||
def txbump4(self,f1,f2,f3,f4,f5,f6,f7,f8,f9): # f7:txfile,f9:'txdo'
|
||||
|
|
|
|||
|
|
@ -63,7 +63,10 @@ class TestSuiteShared(object):
|
|||
if have_est_fee and not interactive_fee:
|
||||
t.send('y')
|
||||
else:
|
||||
if have_est_fee: t.send('n')
|
||||
if have_est_fee:
|
||||
t.send('n')
|
||||
if g.proto.base_coin == 'ETH': # TODO: pexpect race condition?
|
||||
time.sleep(0.05)
|
||||
if eth_fee_res:
|
||||
t.expect('or gas price: ',interactive_fee+'\n')
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue