Skip to content

Commit

Permalink
cli: Refactor old test to avoid fcntl
Browse files Browse the repository at this point in the history
This is a simple preparation for the next commit, to get rid of
low-level `fcntl.fcntl()` calls, since `os.set_blocking()` now exists
(since Python 3.5).
  • Loading branch information
adrienverge committed Jan 13, 2025
1 parent c20f191 commit 47d27d9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import fcntl
import locale
import os
import pty
Expand Down Expand Up @@ -510,8 +509,7 @@ def test_run_default_format_output_in_tty(self):

# Read output from TTY
output = os.fdopen(master, 'r')
flag = fcntl.fcntl(master, fcntl.F_GETFD)
fcntl.fcntl(master, fcntl.F_SETFL, flag | os.O_NONBLOCK)
os.set_blocking(master, False)

out = output.read().replace('\r\n', '\n')

Expand Down

0 comments on commit 47d27d9

Please sign in to comment.