From 29fb803be1559a7dc85a5cb847375a7db0d09ea7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 Jun 2020 12:36:57 +0300 Subject: [PATCH] Enable PIO Core tests on Python 3.8 --- .github/workflows/core.yml | 2 +- platformio/commands/project.py | 3 +-- tests/commands/test_account_org_team.py | 36 ++++++++++++------------- tests/commands/test_check.py | 2 +- tests/commands/test_ci.py | 14 ++++++---- tests/commands/test_lib.py | 16 +++++------ tests/commands/test_platform.py | 22 +++++++-------- tests/commands/test_test.py | 8 +++--- tests/conftest.py | 23 ++++++++++++---- tests/package/test_manifest.py | 3 ++- tests/test_builder.py | 2 +- tests/test_ino2cpp.py | 4 +-- tests/test_maintenance.py | 12 ++++----- tests/test_managers.py | 4 +-- tests/test_misc.py | 4 +-- 15 files changed, 87 insertions(+), 68 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index c6e15bfd..e0aed6a9 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -8,7 +8,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: [2.7, 3.7] + python-version: [2.7, 3.7, 3.8] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 diff --git a/platformio/commands/project.py b/platformio/commands/project.py index 5bd5efcb..27e33455 100644 --- a/platformio/commands/project.py +++ b/platformio/commands/project.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=too-many-arguments,too-many-locals, too-many-branches +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,line-too-long import os @@ -238,7 +238,6 @@ https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html def init_lib_readme(lib_dir): - # pylint: disable=line-too-long with open(os.path.join(lib_dir, "README"), "w") as fp: fp.write( """ diff --git a/tests/commands/test_account_org_team.py b/tests/commands/test_account_org_team.py index 297e4c12..b6d5b6d4 100644 --- a/tests/commands/test_account_org_team.py +++ b/tests/commands/test_account_org_team.py @@ -62,7 +62,7 @@ def test_prepare(): def test_account_register( - clirunner, validate_cliresult, receive_email, isolated_pio_home + clirunner, validate_cliresult, receive_email, isolated_pio_core ): result = clirunner.invoke( cmd_account, @@ -97,14 +97,14 @@ def test_account_register( def test_account_login( - clirunner, validate_cliresult, isolated_pio_home, + clirunner, validate_cliresult, isolated_pio_core, ): result = clirunner.invoke(cmd_account, ["login", "-u", username, "-p", password],) validate_cliresult(result) def test_account_summary( - clirunner, validate_cliresult, isolated_pio_home, + clirunner, validate_cliresult, isolated_pio_core, ): result = clirunner.invoke(cmd_account, ["show", "--json-output", "--offline"]) validate_cliresult(result) @@ -156,7 +156,7 @@ def test_account_summary( assert json_result.get("subscriptions") is not None -def test_account_token(clirunner, validate_cliresult, isolated_pio_home): +def test_account_token(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke(cmd_account, ["token", "--password", password,],) validate_cliresult(result) assert "Personal Authentication Token:" in result.output @@ -198,7 +198,7 @@ def test_account_token(clirunner, validate_cliresult, isolated_pio_home): validate_cliresult(result) -def test_account_change_password(clirunner, validate_cliresult, isolated_pio_home): +def test_account_change_password(clirunner, validate_cliresult, isolated_pio_core): new_password = "Testpassword123" result = clirunner.invoke( cmd_account, @@ -222,7 +222,7 @@ def test_account_change_password(clirunner, validate_cliresult, isolated_pio_hom def test_account_update( - clirunner, validate_cliresult, receive_email, isolated_pio_home + clirunner, validate_cliresult, receive_email, isolated_pio_core ): global username global email @@ -281,7 +281,7 @@ def test_account_update( # def test_account_destroy_with_linked_resources( -# clirunner, validate_cliresult, receive_email, isolated_pio_home, tmpdir_factory +# clirunner, validate_cliresult, receive_email, isolated_pio_core, tmpdir_factory # ): # package_url = "https://github.com/bblanchon/ArduinoJson/archive/v6.11.0.tar.gz" # @@ -312,14 +312,14 @@ def test_account_update( # validate_cliresult(result) -def test_org_create(clirunner, validate_cliresult, isolated_pio_home): +def test_org_create(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cmd_org, ["create", "--email", email, "--displayname", display_name, orgname], ) validate_cliresult(result) -def test_org_list(clirunner, validate_cliresult, isolated_pio_home): +def test_org_list(clirunner, validate_cliresult, isolated_pio_core): # pio org list result = clirunner.invoke(cmd_org, ["list", "--json-output"]) validate_cliresult(result) @@ -336,7 +336,7 @@ def test_org_list(clirunner, validate_cliresult, isolated_pio_home): ] -def test_org_add_owner(clirunner, validate_cliresult, isolated_pio_home): +def test_org_add_owner(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke(cmd_org, ["add", orgname, second_username]) validate_cliresult(result) @@ -345,7 +345,7 @@ def test_org_add_owner(clirunner, validate_cliresult, isolated_pio_home): assert second_username in result.output -def test_org_remove_owner(clirunner, validate_cliresult, isolated_pio_home): +def test_org_remove_owner(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke(cmd_org, ["remove", orgname, second_username]) validate_cliresult(result) @@ -354,7 +354,7 @@ def test_org_remove_owner(clirunner, validate_cliresult, isolated_pio_home): assert second_username not in result.output -def test_org_update(clirunner, validate_cliresult, isolated_pio_home): +def test_org_update(clirunner, validate_cliresult, isolated_pio_core): new_orgname = "neworg-piocore-%s" % str(random.randint(0, 100000)) new_display_name = "Test Org for PIO Core" @@ -399,7 +399,7 @@ def test_org_update(clirunner, validate_cliresult, isolated_pio_home): validate_cliresult(result) -def test_team_create(clirunner, validate_cliresult, isolated_pio_home): +def test_team_create(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cmd_team, ["create", "%s:%s" % (orgname, teamname), "--description", team_description,], @@ -407,7 +407,7 @@ def test_team_create(clirunner, validate_cliresult, isolated_pio_home): validate_cliresult(result) -def test_team_list(clirunner, validate_cliresult, isolated_pio_home): +def test_team_list(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke(cmd_team, ["list", "%s" % orgname, "--json-output"],) validate_cliresult(result) json_result = json.loads(result.output.strip()) @@ -418,7 +418,7 @@ def test_team_list(clirunner, validate_cliresult, isolated_pio_home): ] -def test_team_add_member(clirunner, validate_cliresult, isolated_pio_home): +def test_team_add_member(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cmd_team, ["add", "%s:%s" % (orgname, teamname), second_username], ) @@ -429,7 +429,7 @@ def test_team_add_member(clirunner, validate_cliresult, isolated_pio_home): assert second_username in result.output -def test_team_remove(clirunner, validate_cliresult, isolated_pio_home): +def test_team_remove(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cmd_team, ["remove", "%s:%s" % (orgname, teamname), second_username], ) @@ -440,7 +440,7 @@ def test_team_remove(clirunner, validate_cliresult, isolated_pio_home): assert second_username not in result.output -def test_team_update(clirunner, validate_cliresult, receive_email, isolated_pio_home): +def test_team_update(clirunner, validate_cliresult, receive_email, isolated_pio_core): new_teamname = "new-" + str(random.randint(0, 100000)) newteam_description = "Updated Description" result = clirunner.invoke( @@ -479,7 +479,7 @@ def test_team_update(clirunner, validate_cliresult, receive_email, isolated_pio_ validate_cliresult(result) -def test_cleanup(clirunner, validate_cliresult, receive_email, isolated_pio_home): +def test_cleanup(clirunner, validate_cliresult, receive_email, isolated_pio_core): result = clirunner.invoke(cmd_team, ["destroy", "%s:%s" % (orgname, teamname)], "y") validate_cliresult(result) result = clirunner.invoke(cmd_org, ["destroy", orgname], "y") diff --git a/tests/commands/test_check.py b/tests/commands/test_check.py index c5125b1e..94064bda 100644 --- a/tests/commands/test_check.py +++ b/tests/commands/test_check.py @@ -357,7 +357,7 @@ int main() { assert low_result.exit_code != 0 -def test_check_pvs_studio_free_license(clirunner, tmpdir): +def test_check_pvs_studio_free_license(clirunner, isolated_pio_core, tmpdir): config = """ [env:test] platform = teensy diff --git a/tests/commands/test_ci.py b/tests/commands/test_ci.py index 0f7aceed..8a597413 100644 --- a/tests/commands/test_ci.py +++ b/tests/commands/test_ci.py @@ -24,7 +24,7 @@ def test_ci_empty(clirunner): assert "Invalid value: Missing argument 'src'" in result.output -def test_ci_boards(clirunner, validate_cliresult): +def test_ci_boards(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cmd_ci, [ @@ -38,7 +38,7 @@ def test_ci_boards(clirunner, validate_cliresult): validate_cliresult(result) -def test_ci_build_dir(clirunner, tmpdir_factory, validate_cliresult): +def test_ci_build_dir(clirunner, tmpdir_factory, validate_cliresult, isolated_pio_core): build_dir = str(tmpdir_factory.mktemp("ci_build_dir")) result = clirunner.invoke( cmd_ci, @@ -54,7 +54,9 @@ def test_ci_build_dir(clirunner, tmpdir_factory, validate_cliresult): assert not isfile(join(build_dir, "platformio.ini")) -def test_ci_keep_build_dir(clirunner, tmpdir_factory, validate_cliresult): +def test_ci_keep_build_dir( + clirunner, tmpdir_factory, validate_cliresult, isolated_pio_core +): build_dir = str(tmpdir_factory.mktemp("ci_build_dir")) result = clirunner.invoke( cmd_ci, @@ -88,7 +90,7 @@ def test_ci_keep_build_dir(clirunner, tmpdir_factory, validate_cliresult): assert "board: metro" in result.output -def test_ci_project_conf(clirunner, validate_cliresult): +def test_ci_project_conf(clirunner, validate_cliresult, isolated_pio_core): project_dir = join("examples", "wiring-blink") result = clirunner.invoke( cmd_ci, @@ -102,7 +104,9 @@ def test_ci_project_conf(clirunner, validate_cliresult): assert "uno" in result.output -def test_ci_lib_and_board(clirunner, tmpdir_factory, validate_cliresult): +def test_ci_lib_and_board( + clirunner, tmpdir_factory, validate_cliresult, isolated_pio_core +): storage_dir = str(tmpdir_factory.mktemp("lib")) result = clirunner.invoke( cmd_lib, ["--storage-dir", storage_dir, "install", "1@2.3.2"] diff --git a/tests/commands/test_lib.py b/tests/commands/test_lib.py index 752c2c30..3341ef71 100644 --- a/tests/commands/test_lib.py +++ b/tests/commands/test_lib.py @@ -34,7 +34,7 @@ def test_search(clirunner, validate_cliresult): assert int(match.group(1)) > 1 -def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_home): +def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cmd_lib, [ @@ -54,7 +54,7 @@ def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_hom assert result.exit_code != 0 assert isinstance(result.exception, exception.LibNotFound) - items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()] + items1 = [d.basename for d in isolated_pio_core.join("lib").listdir()] items2 = [ "ArduinoJson_ID64", "ArduinoJson_ID64@5.10.1", @@ -68,7 +68,7 @@ def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_hom assert set(items1) == set(items2) -def test_global_install_archive(clirunner, validate_cliresult, isolated_pio_home): +def test_global_install_archive(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cmd_lib, [ @@ -93,12 +93,12 @@ def test_global_install_archive(clirunner, validate_cliresult, isolated_pio_home ) assert result.exit_code != 0 - items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()] + items1 = [d.basename for d in isolated_pio_core.join("lib").listdir()] items2 = ["ArduinoJson", "SomeLib_ID54", "OneWire_ID1", "ESP32WebServer"] assert set(items1) >= set(items2) -def test_global_install_repository(clirunner, validate_cliresult, isolated_pio_home): +def test_global_install_repository(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cmd_lib, [ @@ -114,7 +114,7 @@ def test_global_install_repository(clirunner, validate_cliresult, isolated_pio_h ], ) validate_cliresult(result) - items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()] + items1 = [d.basename for d in isolated_pio_core.join("lib").listdir()] items2 = [ "PJON", "PJON@src-79de467ebe19de18287becff0a1fb42d", @@ -260,7 +260,7 @@ def test_global_lib_update(clirunner, validate_cliresult): assert isinstance(result.exception, exception.UnknownPackage) -def test_global_lib_uninstall(clirunner, validate_cliresult, isolated_pio_home): +def test_global_lib_uninstall(clirunner, validate_cliresult, isolated_pio_core): # uninstall using package directory result = clirunner.invoke(cmd_lib, ["-g", "list", "--json-output"]) validate_cliresult(result) @@ -284,7 +284,7 @@ def test_global_lib_uninstall(clirunner, validate_cliresult, isolated_pio_home): ) validate_cliresult(result) - items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()] + items1 = [d.basename for d in isolated_pio_core.join("lib").listdir()] items2 = [ "rs485-nodeproto", "platformio-libmirror", diff --git a/tests/commands/test_platform.py b/tests/commands/test_platform.py index b2db5d83..377c1e28 100644 --- a/tests/commands/test_platform.py +++ b/tests/commands/test_platform.py @@ -18,7 +18,7 @@ from platformio import exception from platformio.commands import platform as cli_platform -def test_search_json_output(clirunner, validate_cliresult, isolated_pio_home): +def test_search_json_output(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cli_platform.platform_search, ["arduino", "--json-output"] ) @@ -48,7 +48,7 @@ def test_install_unknown_from_registry(clirunner): assert isinstance(result.exception, exception.UnknownPackage) -def test_install_known_version(clirunner, validate_cliresult, isolated_pio_home): +def test_install_known_version(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cli_platform.platform_install, ["atmelavr@1.2.0", "--skip-default-package", "--with-package", "tool-avrdude"], @@ -56,10 +56,10 @@ def test_install_known_version(clirunner, validate_cliresult, isolated_pio_home) validate_cliresult(result) assert "atmelavr @ 1.2.0" in result.output assert "Installing tool-avrdude @" in result.output - assert len(isolated_pio_home.join("packages").listdir()) == 1 + assert len(isolated_pio_core.join("packages").listdir()) == 1 -def test_install_from_vcs(clirunner, validate_cliresult, isolated_pio_home): +def test_install_from_vcs(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cli_platform.platform_install, [ @@ -69,7 +69,7 @@ def test_install_from_vcs(clirunner, validate_cliresult, isolated_pio_home): ) validate_cliresult(result) assert "espressif8266" in result.output - assert len(isolated_pio_home.join("packages").listdir()) == 1 + assert len(isolated_pio_core.join("packages").listdir()) == 1 def test_list_json_output(clirunner, validate_cliresult): @@ -88,7 +88,7 @@ def test_list_raw_output(clirunner, validate_cliresult): assert all([s in result.output for s in ("atmelavr", "espressif8266")]) -def test_update_check(clirunner, validate_cliresult, isolated_pio_home): +def test_update_check(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cli_platform.platform_update, ["--only-check", "--json-output"] ) @@ -96,20 +96,20 @@ def test_update_check(clirunner, validate_cliresult, isolated_pio_home): output = json.loads(result.output) assert len(output) == 1 assert output[0]["name"] == "atmelavr" - assert len(isolated_pio_home.join("packages").listdir()) == 1 + assert len(isolated_pio_core.join("packages").listdir()) == 1 -def test_update_raw(clirunner, validate_cliresult, isolated_pio_home): +def test_update_raw(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke(cli_platform.platform_update) validate_cliresult(result) assert "Uninstalling atmelavr @ 1.2.0:" in result.output assert "PlatformManager: Installing atmelavr @" in result.output - assert len(isolated_pio_home.join("packages").listdir()) == 1 + assert len(isolated_pio_core.join("packages").listdir()) == 1 -def test_uninstall(clirunner, validate_cliresult, isolated_pio_home): +def test_uninstall(clirunner, validate_cliresult, isolated_pio_core): result = clirunner.invoke( cli_platform.platform_uninstall, ["atmelavr", "espressif8266"] ) validate_cliresult(result) - assert not isolated_pio_home.join("platforms").listdir() + assert not isolated_pio_core.join("platforms").listdir() diff --git a/tests/commands/test_test.py b/tests/commands/test_test.py index 4110188f..608b0310 100644 --- a/tests/commands/test_test.py +++ b/tests/commands/test_test.py @@ -20,7 +20,7 @@ from platformio import util from platformio.commands.test.command import cli as cmd_test -def test_local_env(): +def test_local_env(isolated_pio_core): result = util.exec_command( [ "platformio", @@ -38,7 +38,7 @@ def test_local_env(): ] -def test_multiple_env_build(clirunner, validate_cliresult, tmpdir): +def test_multiple_env_build(clirunner, validate_cliresult, isolated_pio_core, tmpdir): project_dir = tmpdir.mkdir("project") project_dir.join("platformio.ini").write( @@ -80,7 +80,9 @@ int main() { assert "Multiple ways to build" not in result.output -def test_setup_teardown_are_compilable(clirunner, validate_cliresult, tmpdir): +def test_setup_teardown_are_compilable( + clirunner, validate_cliresult, isolated_pio_core, tmpdir +): project_dir = tmpdir.mkdir("project") project_dir.join("platformio.ini").write( diff --git a/tests/conftest.py b/tests/conftest.py index eda52184..0978b2ef 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -42,15 +42,28 @@ def clirunner(): @pytest.fixture(scope="module") -def isolated_pio_home(request, tmpdir_factory): - home_dir = tmpdir_factory.mktemp(".platformio") - os.environ["PLATFORMIO_CORE_DIR"] = str(home_dir) +def isolated_pio_core(request, tmpdir_factory): + core_dir = tmpdir_factory.mktemp(".platformio") + backup_env_vars = { + "PLATFORMIO_CORE_DIR": {"new": str(core_dir)}, + "PLATFORMIO_WORKSPACE_DIR": {"new": None}, + } + for key, item in backup_env_vars.items(): + backup_env_vars[key]["old"] = os.environ.get(key) + if item["new"] is not None: + os.environ[key] = item["new"] + elif key in os.environ: + del os.environ[key] def fin(): - del os.environ["PLATFORMIO_CORE_DIR"] + for key, item in backup_env_vars.items(): + if item["old"] is None: + del os.environ[key] + else: + os.environ[key] = item["old"] request.addfinalizer(fin) - return home_dir + return core_dir @pytest.fixture(scope="function") diff --git a/tests/package/test_manifest.py b/tests/package/test_manifest.py index 13dff94e..cef5900d 100644 --- a/tests/package/test_manifest.py +++ b/tests/package/test_manifest.py @@ -83,7 +83,7 @@ def test_library_json_parser(): }, "dependencies": [ {"name": "deps1", "version": "1.0.0"}, - {"name": "@owner/deps2", "version": "1.0.0", "frameworks": "arduino, espidf"}, + {"name": "@owner/deps2", "version": "1.0.0", "platforms": "atmelavr, espressif32", "frameworks": "arduino, espidf"}, {"name": "deps3", "version": "1.0.0", "platforms": ["ststm32", "sifive"]} ] } @@ -101,6 +101,7 @@ def test_library_json_parser(): { "name": "@owner/deps2", "version": "1.0.0", + "platforms": ["atmelavr", "espressif32"], "frameworks": ["arduino", "espidf"], }, {"name": "deps1", "version": "1.0.0"}, diff --git a/tests/test_builder.py b/tests/test_builder.py index f220e50c..dd0fe1f2 100644 --- a/tests/test_builder.py +++ b/tests/test_builder.py @@ -15,7 +15,7 @@ from platformio.commands.run.command import cli as cmd_run -def test_build_flags(clirunner, validate_cliresult, tmpdir): +def test_build_flags(clirunner, isolated_pio_core, validate_cliresult, tmpdir): build_flags = [ ("-D TEST_INT=13", "-DTEST_INT=13"), ("-DTEST_SINGLE_MACRO", "-DTEST_SINGLE_MACRO"), diff --git a/tests/test_ino2cpp.py b/tests/test_ino2cpp.py index d1434df7..af91da8d 100644 --- a/tests/test_ino2cpp.py +++ b/tests/test_ino2cpp.py @@ -31,12 +31,12 @@ def pytest_generate_tests(metafunc): metafunc.parametrize("piotest_dir", test_dirs) -def test_example(clirunner, validate_cliresult, piotest_dir): +def test_example(clirunner, isolated_pio_core, validate_cliresult, piotest_dir): result = clirunner.invoke(cmd_ci, [piotest_dir, "-b", "uno"]) validate_cliresult(result) -def test_warning_line(clirunner, validate_cliresult): +def test_warning_line(clirunner, isolated_pio_core, validate_cliresult): result = clirunner.invoke(cmd_ci, [join(INOTEST_DIR, "basic"), "-b", "uno"]) validate_cliresult(result) assert 'basic.ino:16:14: warning: #warning "Line number is 16"' in result.output diff --git a/tests/test_maintenance.py b/tests/test_maintenance.py index c004f28f..34d4ce68 100644 --- a/tests/test_maintenance.py +++ b/tests/test_maintenance.py @@ -22,7 +22,7 @@ from platformio.commands import upgrade as cmd_upgrade from platformio.managers.platform import PlatformManager -def test_check_pio_upgrade(clirunner, isolated_pio_home, validate_cliresult): +def test_check_pio_upgrade(clirunner, isolated_pio_core, validate_cliresult): def _patch_pio_version(version): maintenance.__version__ = version cmd_upgrade.VERSION = version.split(".", 3) @@ -51,7 +51,7 @@ def test_check_pio_upgrade(clirunner, isolated_pio_home, validate_cliresult): _patch_pio_version(origin_version) -def test_check_lib_updates(clirunner, isolated_pio_home, validate_cliresult): +def test_check_lib_updates(clirunner, isolated_pio_core, validate_cliresult): # install obsolete library result = clirunner.invoke(cli_pio, ["lib", "-g", "install", "ArduinoJson@<6.13"]) validate_cliresult(result) @@ -66,7 +66,7 @@ def test_check_lib_updates(clirunner, isolated_pio_home, validate_cliresult): assert "There are the new updates for libraries (ArduinoJson)" in result.output -def test_check_and_update_libraries(clirunner, isolated_pio_home, validate_cliresult): +def test_check_and_update_libraries(clirunner, isolated_pio_core, validate_cliresult): # enable library auto-updates result = clirunner.invoke( cli_pio, ["settings", "set", "auto_update_libraries", "Yes"] @@ -96,11 +96,11 @@ def test_check_and_update_libraries(clirunner, isolated_pio_home, validate_clire assert prev_data[0]["version"] != json.loads(result.output)[0]["version"] -def test_check_platform_updates(clirunner, isolated_pio_home, validate_cliresult): +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) - manifest_path = isolated_pio_home.join("platforms", "native", "platform.json") + 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)) @@ -117,7 +117,7 @@ def test_check_platform_updates(clirunner, isolated_pio_home, validate_cliresult assert "There are the new updates for platforms (native)" in result.output -def test_check_and_update_platforms(clirunner, isolated_pio_home, validate_cliresult): +def test_check_and_update_platforms(clirunner, isolated_pio_core, validate_cliresult): # enable library auto-updates result = clirunner.invoke( cli_pio, ["settings", "set", "auto_update_platforms", "Yes"] diff --git a/tests/test_managers.py b/tests/test_managers.py index f4ab2ed8..308523cd 100644 --- a/tests/test_managers.py +++ b/tests/test_managers.py @@ -165,7 +165,7 @@ def test_pkg_input_parser(): assert PackageManager.parse_pkg_uri(params) == result -def test_install_packages(isolated_pio_home, tmpdir): +def test_install_packages(isolated_pio_core, tmpdir): packages = [ dict(id=1, name="name_1", version="shasum"), dict(id=1, name="name_1", version="2.0.0"), @@ -198,7 +198,7 @@ def test_install_packages(isolated_pio_home, tmpdir): "name_2@src-f863b537ab00f4c7b5011fc44b120e1f", ] assert set( - [p.basename for p in isolated_pio_home.join("packages").listdir()] + [p.basename for p in isolated_pio_core.join("packages").listdir()] ) == set(pkg_dirnames) diff --git a/tests/test_misc.py b/tests/test_misc.py index aee9f113..d01cc46d 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -29,12 +29,12 @@ def test_ping_internet_ips(): requests.get("http://%s" % host, allow_redirects=False, timeout=2) -def test_api_internet_offline(without_internet, isolated_pio_home): +def test_api_internet_offline(without_internet, isolated_pio_core): with pytest.raises(exception.InternetIsOffline): util.get_api_result("/stats") -def test_api_cache(monkeypatch, isolated_pio_home): +def test_api_cache(monkeypatch, isolated_pio_core): api_kwargs = {"url": "/stats", "cache_valid": "10s"} result = util.get_api_result(**api_kwargs) assert result and "boards" in result