diff --git a/spyder/plugins/ipythonconsole/tests/conftest.py b/spyder/plugins/ipythonconsole/tests/conftest.py index be9cf9ed3d9..3e2fb638f0e 100644 --- a/spyder/plugins/ipythonconsole/tests/conftest.py +++ b/spyder/plugins/ipythonconsole/tests/conftest.py @@ -35,7 +35,6 @@ # ---- Constants # ============================================================================= SHELL_TIMEOUT = 40000 if os.name == 'nt' else 20000 -TEMP_DIRECTORY = tempfile.gettempdir() NEW_DIR = 'new_workingdir' PY312_OR_GREATER = sys.version_info[:2] >= (3, 12) diff --git a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py index 6191a2110f6..e28819f13ee 100644 --- a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py +++ b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py @@ -40,7 +40,7 @@ from spyder.plugins.help.tests.test_plugin import check_text from spyder.plugins.ipythonconsole.tests.conftest import ( get_conda_test_env, get_console_background_color, get_console_font_color, - NEW_DIR, SHELL_TIMEOUT, TEMP_DIRECTORY, PY312_OR_GREATER) + NEW_DIR, SHELL_TIMEOUT, PY312_OR_GREATER) from spyder.plugins.ipythonconsole.widgets import ShellWidget from spyder.utils.conda import get_list_conda_envs @@ -390,18 +390,18 @@ def test_console_import_namespace(ipyconsole, qtbot): @flaky(max_runs=3) -def test_console_disambiguation(ipyconsole, qtbot): +def test_console_disambiguation(tmp_path, ipyconsole, qtbot): """Test the disambiguation of dedicated consoles.""" - # Create directories and file for TEMP_DIRECTORY/a/b/c.py - # and TEMP_DIRECTORY/a/d/c.py - dir_b = osp.join(TEMP_DIRECTORY, 'a', 'b') + # Create directories and file for tmp_path/a/b/c.py + # and tmp_path/a/d/c.py + dir_b = osp.join(tmp_path, 'a', 'b') filename_b = osp.join(dir_b, 'c.py') if not osp.isdir(dir_b): os.makedirs(dir_b) if not osp.isfile(filename_b): file_c = open(filename_b, 'w+') file_c.close() - dir_d = osp.join(TEMP_DIRECTORY, 'a', 'd') + dir_d = osp.join(tmp_path, 'a', 'd') filename_d = osp.join(dir_d, 'c.py') if not osp.isdir(dir_d): os.makedirs(dir_d)