Skip to content

Improve Pyxsim tester output#57

Open
xross wants to merge 2 commits into
xmos:developfrom
xross:feat/colors
Open

Improve Pyxsim tester output#57
xross wants to merge 2 commits into
xmos:developfrom
xross:feat/colors

Conversation

@xross
Copy link
Copy Markdown
Contributor

@xross xross commented May 28, 2026

  • Color expected comparison output
  • Flush setup output before simulator capture

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves Pyxsim test reporting by colorizing expected/golden output in the ComparisonChecker and flushing pre-simulator captured stdout/stderr so setup output appears in the right place. Also gates printing of the GOLDEN: line behind a higher verbosity level than the OUTPUT: line.

Changes:

  • Add colorama (>=0.4.6) to runtime dependencies and apply yellow/red ANSI styling to expected output and failure messages in testers.py.
  • Raise the verbosity threshold for printing GOLDEN: lines from > 0 to > 1, and update the CHANGELOG accordingly.
  • In run_on_simulator_, drain any previously captured stdout/stderr via capfd and re-emit it before the simulator runs so setup output isn't swallowed.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
setup.py Adds colorama>=0.4.6 to install_requires.
requirements.txt Pins colorama==0.4.6 for the dev/runtime requirements.
lib/python/Pyxsim/testers.py Initializes colorama, colorizes GOLDEN/Expected/Missing output, splits GOLDEN print to verbosity > 1.
lib/python/Pyxsim/init.py Flushes captured setup stdout/stderr through capfd before running the simulator.
CHANGELOG.rst Documents the verbosity change for ComparisonChecker.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.rst Outdated
* ADDED: Methods in Xsi class for getting the xsim tick frequency
* CHANGED: Pyxsim CMake build uses XCommon CMake
* CHANGED: The way time is incremented by time_step for better floating point precision
* CHANGED: ComparisonChecker only prints expected output when verbosity is 1 or higher (i.e.
Comment on lines +154 to 160
(
"Line %d of output not found in expected\n"
+ f" {Fore.YELLOW}Expected (one of matching lines){Style.RESET_ALL}\n"
+ " Actual : %s"
)
% (line_num, line.strip())
)
xross added 2 commits May 28, 2026 18:24
- Color expected comparison output
- Flush setup output before simulator capture# Please enter the commit message for your changes. Lines starting
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