From 41144bffebcf5a8f6c824d28759b0c00bebe9b42 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 8 Mar 2022 18:00:10 +0200 Subject: [PATCH] Reset custom project config per command --- platformio/commands/check/command.py | 3 +++ platformio/commands/run/command.py | 17 ++++++++++------- platformio/commands/test/command.py | 3 +++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/platformio/commands/check/command.py b/platformio/commands/check/command.py index 3b6a294b..61e7ee56 100644 --- a/platformio/commands/check/command.py +++ b/platformio/commands/check/command.py @@ -168,6 +168,9 @@ def cli( elif not silent: print_check_summary(results) + # Reset custom project config + app.set_session_var("custom_project_conf", None) + command_failed = any(r.get("succeeded") is False for r in results) if command_failed: raise exception.ReturnErrorCode(1) diff --git a/platformio/commands/run/command.py b/platformio/commands/run/command.py index 85fddd72..68a5c46c 100644 --- a/platformio/commands/run/command.py +++ b/platformio/commands/run/command.py @@ -92,6 +92,7 @@ def cli( is_test_running = CTX_META_TEST_IS_RUNNING in ctx.meta + results = [] with fs.cd(project_dir): config = ProjectConfig.get_instance(project_conf) config.validate(environment) @@ -114,7 +115,6 @@ def cli( handle_legacy_libdeps(project_dir, config) default_envs = config.default_envs() - results = [] for env in config.envs(): skipenv = any( [ @@ -145,14 +145,17 @@ def cli( ) ) - command_failed = any(r.get("succeeded") is False for r in results) + command_failed = any(r.get("succeeded") is False for r in results) - if not is_test_running and (command_failed or not silent) and len(results) > 1: - print_processing_summary(results, verbose) + if not is_test_running and (command_failed or not silent) and len(results) > 1: + print_processing_summary(results, verbose) - if command_failed: - raise exception.ReturnErrorCode(1) - return True + # Reset custom project config + app.set_session_var("custom_project_conf", None) + + if command_failed: + raise exception.ReturnErrorCode(1) + return True def process_env( diff --git a/platformio/commands/test/command.py b/platformio/commands/test/command.py index 39f509d4..ae511a9b 100644 --- a/platformio/commands/test/command.py +++ b/platformio/commands/test/command.py @@ -175,6 +175,9 @@ def cli( # pylint: disable=redefined-builtin print_processing_footer(result) + # Reset custom project config + app.set_session_var("custom_project_conf", None) + if without_testing: return