Skip to content

Commit dc06608

Browse files
committed
Update to pytest.ini, upgrade pytest to properly handle __main__.py
1 parent 87149b5 commit dc06608

File tree

8 files changed

+47
-11
lines changed

8 files changed

+47
-11
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
#omit = hdwallet/libs/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ dist/
2626
.eggs
2727
private_keys
2828
images/SLIP-39.iconset
29+
.coverage

GNUmakefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ help:
7474
@echo " print-PLATFORM prints the detected PLATFORM"
7575

7676
test:
77-
cd slip39 && $(PY3TEST)
78-
77+
$(PY3TEST)
7978

8079
analyze:
8180
flake8 -j 1 --max-line-length=200 \
@@ -657,10 +656,10 @@ clean:
657656

658657
# Run only tests with a prefix containing the target string, eg test-blah
659658
test-%:
660-
cd slip39 && $(PY3TEST) *$*_test.py
659+
slip39/*$*_test.py
661660

662661
unit-%:
663-
cd slip39 && $(PY3TEST) -k $*
662+
$(PY3TEST) -k $*
664663

665664

666665
#

fonts_list.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from tkinter import Tk, font
2+
import PySimpleGUI as sg
3+
root = Tk()
4+
font_tuple = font.families()
5+
#Creates a Empty list to hold font names
6+
FontList=[]
7+
fonts = [font.Font(family=f) for f in font.families()]
8+
monospace = (f for f in fonts if f.metrics("fixed"))
9+
# for font in font_tuple:
10+
# FontList.append(font)
11+
for font in monospace:
12+
FontList.append(font.actual('family'))
13+
root.destroy()
14+
print( '\n'.join( FontList ))
15+
16+
#size 28, 28 is optimized for my Android phone please tweak as per your screen
17+
#Scrolled popup to accommodate big list
18+
sg.popup_scrolled(FontList, title='All fonts installed using PySimpleGUI', size=(28,28), grab_anywhere=True)
19+

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
testpaths = slip39
3+
addopts = -vv --doctest-modules --cov=slip39 --cov-config=.coveragerc

requirements-dev.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
build
2+
cx_Freeze >= 6.12
23
flake8
34
pip
4-
pytest
5-
setuptools
6-
wheel
75
pyinstaller >= 5.5
8-
cx_Freeze >= 6.12
6+
pytest >=7.2.0,<8
7+
pytest-cov >=4.0.0,<5
8+
setuptools
99
tabulate
10+
wheel

requirements-tests.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
flake8
2-
pytest
2+
pytest >=7.2.0,<8
3+
pytest-cov >=4.0.0,<5

slip39/cli/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@
1818
import click
1919
import json
2020
import logging
21+
import string
2122

2223
from .. import addresses as slip39_addresses
23-
from ..util import log_cfg, log_level
24+
from ..util import log_cfg, log_level, input_secure
2425

2526
"""
2627
Provide basic CLI access to the slip39 API.
2728
2829
Output generally defaults to JSON. Use -v for more details, and --no-json to emit standard text output instead.
2930
"""
3031

32+
log = logging.getLogger( __package__ )
33+
3134

3235
@click.group()
3336
@click.option('-v', '--verbose', count=True)
@@ -47,10 +50,17 @@ def cli( verbose, quiet, json ):
4750
@click.command()
4851
@click.option( "--crypto", help="The cryptocurrency address to generate (default: BTC)" )
4952
@click.option( "--paths", help="The HD wallet derivation path (default: the standard path for the cryptocurrency; if xpub, omits leading hardened segments by default)" )
50-
@click.option( "--secret", help="A seed or '{x,y,z}{pub,prv}...' x-public/private key to derive HD wallet addresses from" )
53+
@click.option( "--secret", help="A hex seed or '{x,y,z}{pub,prv}...' x-public/private key to derive HD wallet addresses from; '-' reads it from stdin" )
5154
@click.option( "--format", help="legacy, segwit, bech32 (default: standard for cryptocurrency or '{x,y,z}{pub/prv}...' key)" )
5255
@click.option( '--unbounded/--no-unbounded', default=False, help="Allow unbounded sequences of addresses")
5356
def addresses( crypto, paths, secret, format, unbounded ):
57+
if secret == '-':
58+
secret = input_secure( 'Master secret hex: ', secret=True )
59+
elif secret and ( secret.lower().startswith( '0x' )
60+
or all( c in string.hexdigits for c in secret )):
61+
log.warning( "It is recommended to not use '-s|--secret <hex>'; specify '-' to read from input" )
62+
if secret and secret.lower().startswith('0x'):
63+
secret = secret[2:]
5464
if cli.json:
5565
click.echo( "[" )
5666
for i,(cry,pth,adr) in enumerate( slip39_addresses(

0 commit comments

Comments
 (0)