Skip to content

Commit

Permalink
Use tmp_path fixture instead of TEMP_DIRECTORY constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mrclary committed May 31, 2024
1 parent 94d0aa1 commit 60c9af4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion spyder/plugins/ipythonconsole/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 60c9af4

Please sign in to comment.