GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-41818: Make test_openpty() avoid unexpected success due to number of rows and/or number of columns being == 0. by 8vasu · Pull Request #23526 · python/cpython

bpo-41818: Make test_openpty() avoid unexpected success due to number of rows and/or number of columns being == 0. #23526

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.

Sign up for GitHub

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

Merged
asvetlov merged 2 commits into python:master from 8vasu:test_openpty_fix
Nov 27, 2020

Uh oh!

There was an error while loading. Please reload this page.

Merged

bpo-41818: Make test_openpty() avoid unexpected success due to number of rows and/or number of columns being == 0. #23526

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
3e2a4cc
Make test_openpty() avoid unexpected success due to number of rows an…
8vasu Nov 27, 2020
278a7f8
📜🤖 Added by blurb_it.
blurb-it[bot] Nov 27, 2020
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

29 changes: 10 additions & 19 deletions 29 Lib/test/test_pty.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import_module('termios')

import errno
import pathlib
import pty
import os
import sys
Expand Down Expand Up @@ -75,20 +74,7 @@ def _readline(fd):
return reader.readline()

def expectedFailureIfStdinIsTTY(fun):
# avoid isatty() for now
PLATFORM = platform.system()
if PLATFORM == "Linux":
os_release = pathlib.Path("/etc/os-release")
if os_release.exists():
# Actually the file has complex multi-line structure,
# these is no need to parse it for Gentoo check
if 'gentoo' in os_release.read_text().lower():
# bpo-41818:
# Gentoo passes the test,
# all other tested Linux distributions fail.
# Should not apply @unittest.expectedFailure() on Gentoo
# to keep the buildbot fleet happy.
return fun
# avoid isatty()
try:
tty.tcgetattr(pty.STDIN_FILENO)
return unittest.expectedFailure(fun)
Expand Down Expand Up @@ -165,11 +151,16 @@ def test_openpty(self):
new_stdin_winsz = None
if self.stdin_rows != None and self.stdin_cols != None:
try:
# Modify pty.STDIN_FILENO window size; we need to
# check if pty.openpty() is able to set pty slave
# window size accordingly.
debug("Setting pty.STDIN_FILENO window size")
# Set number of columns and rows to be the
# floors of 1/5 of respective original values
target_stdin_winsz = struct.pack("HHHH", self.stdin_rows//5,
self.stdin_cols//5, 0, 0)
debug(f"original size: (rows={self.stdin_rows}, cols={self.stdin_cols})")
target_stdin_rows = self.stdin_rows + 1
Comment thread Outdated

@asvetlov asvetlov Nov 27, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a few words to describe the resize trick and why it is necessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@8vasu 8vasu Nov 27, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some comments. Please let me know if this looks good.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
target_stdin_cols = self.stdin_cols + 1
debug(f"target size: (rows={target_stdin_rows}, cols={target_stdin_cols})")
target_stdin_winsz = struct.pack("HHHH", target_stdin_rows,
target_stdin_cols, 0, 0)
_set_term_winsz(pty.STDIN_FILENO, target_stdin_winsz)

# Were we able to set the window size
Expand Down
1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Library/2020-11-27-09-19-43.bpo-41818.KWYUbL.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make test_openpty() avoid unexpected success due to number of rows and/or number of columns being == 0.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.