forked from platformio/platformio-core
Update a complex test for platform install
command
This commit is contained in:
@ -68,16 +68,12 @@ def test_install_uknown_version(clirunner, validate_cliresult):
|
|||||||
|
|
||||||
|
|
||||||
def test_complex(clirunner, validate_cliresult):
|
def test_complex(clirunner, validate_cliresult):
|
||||||
items = [
|
|
||||||
"teensy",
|
|
||||||
"https://github.com/platformio/platform-teensy/archive/develop.zip"
|
|
||||||
]
|
|
||||||
for item in items:
|
|
||||||
with clirunner.isolated_filesystem():
|
with clirunner.isolated_filesystem():
|
||||||
os.environ["PLATFORMIO_HOME_DIR"] = os.getcwd()
|
os.environ["PLATFORMIO_HOME_DIR"] = os.getcwd()
|
||||||
try:
|
try:
|
||||||
result = clirunner.invoke(cli_platform.platform_install,
|
result = clirunner.invoke(
|
||||||
[item])
|
cli_platform.platform_install,
|
||||||
|
["teensy", "--with-package", "framework-arduinoteensy"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert all([
|
assert all([
|
||||||
s in result.output
|
s in result.output
|
||||||
@ -85,8 +81,7 @@ def test_complex(clirunner, validate_cliresult):
|
|||||||
])
|
])
|
||||||
|
|
||||||
# show platform information
|
# show platform information
|
||||||
result = clirunner.invoke(cli_platform.platform_show,
|
result = clirunner.invoke(cli_platform.platform_show, ["teensy"])
|
||||||
["teensy"])
|
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert "teensy" in result.output
|
assert "teensy" in result.output
|
||||||
|
|
||||||
@ -98,7 +93,7 @@ def test_complex(clirunner, validate_cliresult):
|
|||||||
assert isinstance(list_result, list)
|
assert isinstance(list_result, list)
|
||||||
assert len(list_result) == 1
|
assert len(list_result) == 1
|
||||||
assert list_result[0]["name"] == "teensy"
|
assert list_result[0]["name"] == "teensy"
|
||||||
assert list_result[0]["packages"] == []
|
assert list_result[0]["packages"] == ["framework-arduinoteensy"]
|
||||||
|
|
||||||
# try to install again
|
# try to install again
|
||||||
result = clirunner.invoke(cli_platform.platform_install,
|
result = clirunner.invoke(cli_platform.platform_install,
|
||||||
@ -107,17 +102,18 @@ def test_complex(clirunner, validate_cliresult):
|
|||||||
assert "is already installed" in result.output
|
assert "is already installed" in result.output
|
||||||
|
|
||||||
# try to update
|
# try to update
|
||||||
|
for _ in range(2):
|
||||||
result = clirunner.invoke(cli_platform.platform_update)
|
result = clirunner.invoke(cli_platform.platform_update)
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert "teensy" in result.output
|
assert "teensy" in result.output
|
||||||
# assert "Up-to-date" in result.output
|
assert "Up-to-date" in result.output
|
||||||
|
assert "Out-of-date" not in result.output
|
||||||
|
|
||||||
# try to uninstall
|
# try to uninstall
|
||||||
result = clirunner.invoke(cli_platform.platform_uninstall,
|
result = clirunner.invoke(cli_platform.platform_uninstall,
|
||||||
["teensy"])
|
["teensy"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
for folder in ("platforms", "packages"):
|
for folder in ("platforms", "packages"):
|
||||||
assert len(os.listdir(join(util.get_home_dir(),
|
assert len(os.listdir(join(util.get_home_dir(), folder))) == 0
|
||||||
folder))) == 0
|
|
||||||
finally:
|
finally:
|
||||||
del os.environ["PLATFORMIO_HOME_DIR"]
|
del os.environ["PLATFORMIO_HOME_DIR"]
|
||||||
|
Reference in New Issue
Block a user