Skip to content

Fix the failure of TestInputSocket.py when extra lines are found.#1392

Merged
bcoconni merged 1 commit intoJSBSim-Team:masterfrom
bcoconni:fix_test_input_socket
Feb 15, 2026
Merged

Fix the failure of TestInputSocket.py when extra lines are found.#1392
bcoconni merged 1 commit intoJSBSim-Team:masterfrom
bcoconni:fix_test_input_socket

Conversation

@bcoconni
Copy link
Copy Markdown
Member

I had several occurrences in a row where the Ubuntu builds of the CI workflow are failing with the following error (note the empty string at the start of one list):

Lists differ: ['', 'get', 'help', 'hold', 'info', 'iterate', 'quit', 'resume', 'set'] != ['get', 'help', 'hold', 'info', 'iterate', 'quit', 'resume', 'set']

First differing element 0:
''
'get'

First list contains 1 additional elements.
First extra element 8:
'set'

- ['', 'get', 'help', 'hold', 'info', 'iterate', 'quit', 'resume', 'set']
?  ----

+ ['get', 'help', 'hold', 'info', 'iterate', 'quit', 'resume', 'set']
FAIL

I am not sure why Ubuntu is triggering this error while other platforms do not. And previously it was occurring seldomly while it is now happening systematically on the Ubuntu runners. This may be linked to the fact that CRLF are used in the help string while our Python code is splitting the lines using split("\n"):

socket->Reply(
" JSBSim Server commands:\r\n\r\n"
" get {property name}\r\n"
" set {property name} {value}\r\n"
" hold\r\n"
" resume\r\n"
" iterate {value}\r\n"
" help\r\n"
" quit\r\n"
" info\r\n\r\n");

out = await self.telnet.send_command("help")
# Check that "help" returns the minimum set of commands that will be
# tested
self.assertEqual(
sorted(
map(
lambda x: x.split("{")[0].strip(),
out.split("\n")[2:-1],

This PR is replacing all occurrences of .split("\n") by .splitlines(). The latter handles correctly the various ends of lines (\n, \r\n, etc.). Following this change, the error stopped to occur on my fork.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 25.29%. Comparing base (3003423) to head (b35ec89).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1392   +/-   ##
=======================================
  Coverage   25.29%   25.29%           
=======================================
  Files         169      169           
  Lines       18570    18570           
=======================================
  Hits         4697     4697           
  Misses      13873    13873           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bcoconni bcoconni changed the title Fix the failure of TestInputSocket.py when extra lines are detected. Fix the failure of TestInputSocket.py when extra lines are found. Feb 15, 2026
@bcoconni
Copy link
Copy Markdown
Member Author

The bug has been inadvertently demonstrated by the PR #1393.

@seanmcleod70
Copy link
Copy Markdown
Contributor

Looks good.

@bcoconni bcoconni merged commit 1a2e114 into JSBSim-Team:master Feb 15, 2026
28 checks passed
@bcoconni bcoconni deleted the fix_test_input_socket branch February 15, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants