Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Lib/test/test_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,6 @@ def _get_expected_config(self):
def get_expected_config(self, expected_preconfig, expected,
expected_pathconfig, env, api,
modify_path_cb=None):
cls = self.__class__
configs = self._get_expected_config()

pre_config = configs['pre_config']
Expand Down Expand Up @@ -1235,7 +1234,6 @@ def test_init_setpythonhome(self):
self.fail(f"Unable to find home in {paths!r}")

prefix = exec_prefix = home
ver = sys.version_info
expected_paths = self.module_search_paths(prefix=home, exec_prefix=home)

config = {
Expand Down Expand Up @@ -1505,8 +1503,7 @@ class StdPrinterTests(EmbeddingTestsMixin, unittest.TestCase):
# "Set up a preliminary stderr printer until we have enough
# infrastructure for the io module in place."

def get_stdout_fd(self):
return sys.__stdout__.fileno()
STDOUT_FD = 1

def create_printer(self, fd):
ctypes = import_helper.import_module('ctypes')
Expand All @@ -1518,7 +1515,7 @@ def create_printer(self, fd):
def test_write(self):
message = "unicode:\xe9-\u20ac-\udc80!\n"

stdout_fd = self.get_stdout_fd()
stdout_fd = self.STDOUT_FD
stdout_fd_copy = os.dup(stdout_fd)
self.addCleanup(os.close, stdout_fd_copy)

Expand All @@ -1539,15 +1536,15 @@ def test_write(self):
self.assertEqual(data, message.encode('utf8', 'backslashreplace'))

def test_methods(self):
fd = self.get_stdout_fd()
fd = self.STDOUT_FD
printer = self.create_printer(fd)
self.assertEqual(printer.fileno(), fd)
self.assertEqual(printer.isatty(), os.isatty(fd))
printer.flush() # noop
printer.close() # noop

def test_disallow_instantiation(self):
fd = self.get_stdout_fd()
fd = self.STDOUT_FD
printer = self.create_printer(fd)
support.check_disallow_instantiation(self, type(printer))

Expand Down