Switch legacy platform manager to the new

This commit is contained in:
Ivan Kravets committed 2020-08-15 23:11:01 +03:00
1 parent bb6fb3fdf8
commit 04694b4126
25 files changed
+470 -1271

No files matched your search

+5 -5
View File
@@ -13,13 +13,13 @@
# limitations under the License.
import json
import os
import re
from time import time
from platformio import app, maintenance
from platformio.__main__ import cli as cli_pio
from platformio.commands import upgrade as cmd_upgrade
from platformio.managers.platform import PlatformManager
def test_check_pio_upgrade(clirunner, isolated_pio_core, validate_cliresult):
@@ -89,7 +89,8 @@ def test_check_and_update_libraries(clirunner, isolated_pio_core, validate_clire
assert "There are the new updates for libraries (ArduinoJson)" in result.output
assert "Please wait while updating libraries" in result.output
assert re.search(
r"Updating bblanchon/ArduinoJson\s+6\.12\.0\s+\[[\d\.]+\]", result.output
r"Updating bblanchon/ArduinoJson\s+6\.12\.0\s+\[Outdated [\d\.]+\]",
result.output,
)
# check updated version
@@ -102,12 +103,11 @@ def test_check_platform_updates(clirunner, isolated_pio_core, validate_cliresult
# install obsolete platform
result = clirunner.invoke(cli_pio, ["platform", "install", "native"])
validate_cliresult(result)
os.remove(str(isolated_pio_core.join("platforms", "native", ".piopm")))
manifest_path = isolated_pio_core.join("platforms", "native", "platform.json")
manifest = json.loads(manifest_path.read())
manifest["version"] = "0.0.0"
manifest_path.write(json.dumps(manifest))
# reset cached manifests
PlatformManager().cache_reset()
# reset check time
interval = int(app.get_setting("check_platforms_interval")) * 3600 * 24
@@ -141,7 +141,7 @@ def test_check_and_update_platforms(clirunner, isolated_pio_core, validate_clire
validate_cliresult(result)
assert "There are the new updates for platforms (native)" in result.output
assert "Please wait while updating platforms" in result.output
assert re.search(r"Updating native\s+@ 0.0.0\s+\[[\d\.]+\]", result.output)
assert re.search(r"Updating native\s+0.0.0\s+\[Outdated [\d\.]+\]", result.output)
# check updated version
result = clirunner.invoke(cli_pio, ["platform", "list", "--json-output"])