Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pathlib.Path instead of os.path.join in test_interactiveshell.py #13769

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 9 additions & 10 deletions IPython/core/tests/test_interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
import tempfile
import unittest
import pytest
from pathlib import Path
from unittest import mock

from os.path import join

from IPython.core.error import InputRejected
from IPython.core.inputtransformer import InputTransformer
from IPython.core import interactiveshell
Expand Down Expand Up @@ -585,16 +584,16 @@ def test_reset_aliasing(self):
class TestSafeExecfileNonAsciiPath(unittest.TestCase):
@onlyif_unicode_paths
def setUp(self):
self.BASETESTDIR = tempfile.mkdtemp()
self.TESTDIR = join(self.BASETESTDIR, u"åäö")
os.mkdir(self.TESTDIR)
with open(
join(self.TESTDIR, "åäötestscript.py"), "w", encoding="utf-8"
) as sfile:
sfile.write("pass\n")
self.BASETESTDIR = Path(tempfile.mkdtemp())
self.TESTDIR = self.BASETESTDIR / "åäö"
self.TESTDIR.mkdir()

self.fname = "åäötestscript.py"
self.TESTFILE = self.TESTDIR / self.fname
self.TESTFILE.write_text("pass\n", encoding="utf-8")

self.oldpath = os.getcwd()
os.chdir(self.TESTDIR)
self.fname = u"åäötestscript.py"

def tearDown(self):
os.chdir(self.oldpath)
Expand Down