diff --git a/Makefile b/Makefile index 3875ef15..3ea8c06e 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ clean: rm -rf build/ rm -rf dist/ rm -rf *.egg-info + rm -rf .tox/ find . -name __pycache__ -exec rm -rf {} \; find . -name .mypy_cache -exec rm -rf {} \; find . -name .pytest_cache -exec rm -rf {} \; diff --git a/deposit.sh b/deposit.sh index 2d066494..132dcb99 100755 --- a/deposit.sh +++ b/deposit.sh @@ -2,23 +2,24 @@ if [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "darwin"* ]]; then echo $OSTYPE - - if [[ $1 == install ]]; then + if [[ $1 == "install" ]]; then + echo "Installing dependencies..." python3 -m pip3 install -r requirements.txt python3 setup.py install exit 1 fi - + echo "Running deposit-cli..." python3 ./eth2deposit/deposit.py "$@" elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then echo $OSTYPE - if [[ $1 == install ]]; then + if [[ $1 == "install" ]]; then + echo "Installing dependencies..." python -m pip install -r requirements.txt python setup.py install exit 1 fi - + echo "Running deposit-cli..." python ./eth2deposit/deposit.py "$@" else diff --git a/setup.py b/setup.py index 9dbfb7e4..8ad98666 100644 --- a/setup.py +++ b/setup.py @@ -6,5 +6,8 @@ setup( name="eth2deposit", + version='0.0.0', + py_modules=["eth2deposit"], packages=find_packages(exclude=('tests', 'docs')), + python_requires=">=3.7,<4", ) diff --git a/test_deposit_script.py b/test_deposit_script.py index 3e66b5e7..e40b87b9 100755 --- a/test_deposit_script.py +++ b/test_deposit_script.py @@ -11,18 +11,26 @@ async def main(): os.mkdir(my_folder_path) if os.name == 'nt': # Windows - script = 'sh deposit.sh' + run_script_cmd = 'sh deposit.sh' else: # Mac or Linux - script = './deposit.sh' + run_script_cmd = './deposit.sh' + + install_cmd = run_script_cmd + ' install' + print('[INFO] Creating subprocess 1: installation:' , install_cmd) + proc = await asyncio.create_subprocess_shell( + install_cmd, + ) + await proc.wait() + print('[INFO] Installed') cmd_args = [ - script, + run_script_cmd, '--num_validators', '1', '--mnemonic_language', 'english', '--password', 'MyPassword', '--folder', my_folder_path, ] - print('[INFO] Creating subprocess') + print('[INFO] Creating subprocess 2: deposit-cli') proc = await asyncio.create_subprocess_shell( ' '.join(cmd_args), stdin=asyncio.subprocess.PIPE, diff --git a/tests/test_cli.py b/tests/test_cli.py index 8c3de151..6c427a06 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -47,14 +47,19 @@ async def test_script(): if not os.path.exists(my_folder_path): os.mkdir(my_folder_path) + if os.name == 'nt': # Windows + run_script_cmd = 'sh deposit.sh' + else: # Mac or Linux + run_script_cmd = './deposit.sh' + + install_cmd = run_script_cmd + ' install' proc = await asyncio.create_subprocess_shell( - './deposit.sh install', - stdin=asyncio.subprocess.PIPE, - stdout=asyncio.subprocess.PIPE, + install_cmd, ) + await proc.wait() cmd_args = [ - './deposit.sh', + run_script_cmd, '--num_validators', '1', '--mnemonic_language', 'english', '--password', 'MyPassword', diff --git a/tox.ini b/tox.ini index 1017a36e..0242f04d 100644 --- a/tox.ini +++ b/tox.ini @@ -5,22 +5,24 @@ envlist= py{37,38}-script [testenv] -usedevelop=True passenv= PYTEST_ADDOPTS -extras = test basepython= py37: python3.7 py38: python3.8 + +[common-install] deps= -r{toxinidir}/requirements.txt -r{toxinidir}/requirements_test.txt [common-core] +deps={[common-install]deps} commands= pytest {posargs:tests} [common-lint] +deps={[common-install]deps} commands= flake8 --config={toxinidir}/flake8.ini {toxinidir}/cli {toxinidir}/tests mypy --config-file {toxinidir}/mypy.ini -p eth2deposit @@ -32,15 +34,19 @@ commands= python {toxinidir}/test_deposit_script.py [testenv:py37-core] +deps={[common-core]deps} commands={[common-core]commands} [testenv:py38-core] +deps={[common-core]deps} commands={[common-core]commands} [testenv:py37-lint] +deps={[common-lint]deps} commands={[common-lint]commands} [testenv:py38-lint] +deps={[common-lint]deps} commands={[common-lint]commands} [testenv:py37-script]