Skip to content

Commit

Permalink
Clear cache for get_user_environment_variables when changing system t…
Browse files Browse the repository at this point in the history
…o ensure next call will retrieve the new change
  • Loading branch information
mrclary committed Dec 14, 2024
1 parent 697827f commit 97ce9a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6468,7 +6468,7 @@ def test_switch_to_plugin(main_window, qtbot):
assert QApplication.focusWidget() is code_editor


@flaky(max_runs=5)
@flaky(max_runs=1)
def test_PYTHONPATH_in_consoles(main_window, qtbot, tmp_path,
restore_user_env):
"""
Expand Down
2 changes: 2 additions & 0 deletions spyder/utils/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ def set_user_env(env, parent=None):
"Please restart this Windows <i>session</i> "
"(not the computer) for changes to take effect.")
)
get_user_environment_variables.cache_clear()
elif os.name == 'posix' and running_in_ci():
text = "\n".join([f"export {k}={v}" for k, v in env_dict.items()])
amend_user_shell_init(text)
get_user_environment_variables.cache_clear()
else:
raise NotImplementedError("Not implemented for platform %s", os.name)

Expand Down

0 comments on commit 97ce9a7

Please sign in to comment.