-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from njgheorghita/pexpect
Add uninstall to arparse arguments
- Loading branch information
Showing
10 changed files
with
138 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import shutil | ||
|
||
import pexpect | ||
|
||
from ethpm_cli._utils.testing import check_dir_trees_equal | ||
|
||
|
||
def test_ethpm_list(test_assets_dir): | ||
ethpm_dir = test_assets_dir / "multiple" / "_ethpm_packages" | ||
child = pexpect.spawn(f"ethpm list --ethpm-dir {ethpm_dir}") | ||
child.expect("EthPM CLI v0.1.0a0\r\n") | ||
child.expect("\r\n") | ||
child.expect( | ||
r"owned==1.0.0 --- \(ipfs://QmbeVyFLSuEUxiXKwSsEjef6icpdTdA4kGG9BcrJXKNKUW\)\r\n" | ||
) | ||
child.expect( | ||
r"wallet==1.0.0 --- \(ipfs://QmRMSm4k37mr2T3A2MGxAj2eAHGR5veibVt1t9Leh5waV1\)\r\n" | ||
) | ||
child.expect( | ||
r"- safe-math-lib==1.0.0 --- \(ipfs://QmWgvM8yXGyHoGWqLFXvareJsoCZVsdrpKNCLMun3RaSJm\)\r\n" | ||
) | ||
child.expect( | ||
r"- owned==1.0.0 --- \(ipfs://QmbeVyFLSuEUxiXKwSsEjef6icpdTdA4kGG9BcrJXKNKUW\)\r\n" | ||
) | ||
|
||
|
||
def test_ethpm_install(tmp_path, test_assets_dir): | ||
ethpm_dir = tmp_path / "_ethpm_packages" | ||
ethpm_dir.mkdir() | ||
child = pexpect.spawn( | ||
"ethpm install ipfs://QmbeVyFLSuEUxiXKwSsEjef6icpdTdA4kGG9BcrJXKNKUW " | ||
f"--ethpm-dir {ethpm_dir}" | ||
) | ||
child.expect("EthPM CLI v0.1.0a0\r\n") | ||
child.expect("\r\n") | ||
child.expect( | ||
"owned package sourced from ipfs://QmbeVyFLSuEUxiXKwSsEjef6icpdTdA4kGG9BcrJXKNKUW " | ||
f"installed to {ethpm_dir}.\r\n" | ||
) | ||
assert check_dir_trees_equal( | ||
ethpm_dir, test_assets_dir / "owned" / "ipfs_uri" / "_ethpm_packages" | ||
) | ||
|
||
|
||
def test_ethpm_uninstall(tmp_path, test_assets_dir): | ||
ethpm_dir = tmp_path / "_ethpm_packages" | ||
shutil.copytree(test_assets_dir / "multiple" / "_ethpm_packages", ethpm_dir) | ||
assert check_dir_trees_equal( | ||
ethpm_dir, test_assets_dir / "multiple" / "_ethpm_packages" | ||
) | ||
child = pexpect.spawn(f"ethpm uninstall owned --ethpm-dir {ethpm_dir}") | ||
child.expect(f"owned uninstalled from {ethpm_dir}\r\n") | ||
assert check_dir_trees_equal( | ||
ethpm_dir, test_assets_dir / "wallet" / "ipfs_uri" / "_ethpm_packages" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import pexpect | ||
|
||
|
||
def test_ipfs_scrape(tmp_path): | ||
ipfs_dir = tmp_path / "ipfs" | ||
ipfs_dir.mkdir() | ||
child = pexpect.spawn(f"ethpm scrape --ipfs-dir {ipfs_dir} --start-block 1") | ||
child.expect("EthPM CLI v0.1.0a0\r\n") | ||
child.expect("\r\n") | ||
child.expect("Scraping from block 1.\r\n") | ||
child.expect("Blocks 1-5001 scraped. 0 VersionRelease events found.\r\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
ASSETS_DIR = Path(__file__).parent / "core" / "assets" | ||
|
||
|
||
@pytest.fixture | ||
def test_assets_dir(): | ||
return ASSETS_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters