From 7eeb89edece28191bca97471ff6b928687c8ed6a Mon Sep 17 00:00:00 2001 From: iamdefinitelyahuman Date: Wed, 19 Feb 2020 12:22:46 +0400 Subject: [PATCH] add env var test cases --- tests/test_install.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/test_install.py b/tests/test_install.py index dbb6d14..64e3121 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -48,3 +48,30 @@ def test_install_osx(): def test_progress_bar(nosolc): solcx.install_solc('0.6.0', show_progress=True) + + +def test_environment_var_path(monkeypatch, tmp_path): + install_folder = solcx.get_solc_folder() + monkeypatch.setenv('SOLCX_BINARY_PATH', tmp_path.as_posix()) + assert solcx.get_solc_folder() != install_folder + + monkeypatch.undo() + assert solcx.get_solc_folder() == install_folder + + +def test_environment_var_versions(monkeypatch, tmp_path): + versions = solcx.get_installed_solc_versions() + monkeypatch.setenv('SOLCX_BINARY_PATH', tmp_path.as_posix()) + assert solcx.get_installed_solc_versions() != versions + + monkeypatch.undo() + assert solcx.get_installed_solc_versions() == versions + + +def test_environment_var_install(monkeypatch, tmp_path): + assert not tmp_path.joinpath('solc-v0.6.0').exists() + + monkeypatch.setenv('SOLCX_BINARY_PATH', tmp_path.as_posix()) + + solcx.install_solc('0.6.0') + assert tmp_path.joinpath('solc-v0.6.0').exists()