mirror of
https://github.com/micropython/micropython.git
synced 2026-06-12 01:25:15 +02:00
30781dce0a
Adds a "# sigint:" directive for repl_ tests that need Ctrl-C to generate SIGINT via the PTY terminal driver. When present, the child process is set up with the PTY as its controlling terminal (via setsid/TIOCSCTTY/tcsetpgrp) so that \x03 written to the PTY master generates SIGINT for the child's process group. This works because MicroPython's REPL restores original terminal settings (with ISIG enabled) before executing user code, allowing the terminal driver to convert \x03 into SIGINT during blocking operations. Test added: - repl_ctrl_c_interrupt_execution.py: Verifies Ctrl-C interrupts a blocking time.sleep() call and the REPL remains functional afterward. Also wraps PTY fd handling in try/finally for all repl_ tests. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
104 lines
3.0 KiB
TOML
104 lines
3.0 KiB
TOML
[tool.codespell]
|
|
count = ""
|
|
ignore-regex = '\b[A-Z]{3}\b'
|
|
ignore-words-list = "ans,asend,deques,dout,emac,extint,hsi,iput,mis,notin,numer,ser,shft,som,synopsys,technic,ure,curren"
|
|
quiet-level = 3
|
|
skip = """
|
|
*/build*,\
|
|
./.git,\
|
|
./drivers/cc3100,\
|
|
./lib,\
|
|
./ports/cc3200/FreeRTOS,\
|
|
./ports/cc3200/bootmgr/sl,\
|
|
./ports/cc3200/hal,\
|
|
./ports/cc3200/simplelink,\
|
|
./ports/cc3200/telnet,\
|
|
./ports/esp32/managed_components,\
|
|
./ports/nrf/drivers/bluetooth/s1*,\
|
|
./ports/stm32/usbhost,\
|
|
./tests,\
|
|
ACKNOWLEDGEMENTS,\
|
|
"""
|
|
|
|
[tool.ruff]
|
|
# Exclude third-party code from linting and formatting
|
|
extend-exclude = [
|
|
"lib",
|
|
"esp-idf",
|
|
"pico-sdk",
|
|
"emsdk",
|
|
"tests/cpydiff/syntax_assign_expr.py" # intentionally incorrect CPython code
|
|
]
|
|
# Include Python source files that don't end with .py
|
|
extend-include = ["tools/cc1"]
|
|
line-length = 99
|
|
target-version = "py38"
|
|
|
|
[tool.ruff.lint]
|
|
exclude = [ # Ruff finds Python SyntaxError in these files
|
|
"tests/basics/string_module_tstring.py",
|
|
"tests/basics/string_tstring_basic.py",
|
|
"tests/basics/string_tstring_basic1.py",
|
|
"tests/basics/string_tstring_constructor.py",
|
|
"tests/basics/string_tstring_errors1.py",
|
|
"tests/basics/string_tstring_format1.py",
|
|
"tests/basics/string_tstring_interpolation1.py",
|
|
"tests/basics/string_tstring_operations.py",
|
|
"tests/basics/string_tstring_parser1.py",
|
|
"tests/cmdline/cmd_compile_only_error.py",
|
|
"tests/cmdline/repl_autocomplete.py",
|
|
"tests/cmdline/repl_autocomplete_underscore.py",
|
|
"tests/cmdline/repl_autoindent.py",
|
|
"tests/cmdline/repl_basic.py",
|
|
"tests/cmdline/repl_cont.py",
|
|
"tests/cmdline/repl_ctrl_c_interrupt_execution.py",
|
|
"tests/cmdline/repl_emacs_keys.py",
|
|
"tests/cmdline/repl_paste.py",
|
|
"tests/cmdline/repl_words_move.py",
|
|
"tests/feature_check/repl_emacs_check.py",
|
|
"tests/feature_check/repl_words_move_check.py",
|
|
"tests/feature_check/tstring.py",
|
|
"tests/micropython/heapalloc_fail_tstring.py",
|
|
"tests/micropython/viper_args.py",
|
|
]
|
|
extend-select = ["C9", "PLC"]
|
|
extend-ignore = [
|
|
"E401",
|
|
"E402",
|
|
"E722",
|
|
"E731",
|
|
"E741",
|
|
"F401",
|
|
"F403",
|
|
"F405",
|
|
"PLC0206",
|
|
"PLC0415", # conditional imports are common in MicroPython
|
|
]
|
|
mccabe.max-complexity = 40
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
# Exclude all tests from linting.
|
|
"tests/**/*.py" = ["ALL"]
|
|
"ports/cc3200/tools/uniflash.py" = ["E711"]
|
|
# manifest.py files are evaluated with some global names pre-defined
|
|
"**/manifest.py" = ["F821"]
|
|
"ports/**/boards/**/manifest_*.py" = ["F821"]
|
|
# Uses assignment expressions.
|
|
"tests/cpydiff/syntax_assign_expr.py" = ["F821"]
|
|
|
|
[tool.ruff.format]
|
|
# Exclude third-party code, and exclude the following tests:
|
|
# basics: needs careful attention before applying automatic formatting
|
|
# repl_: not real python files
|
|
# tstring: ruff does not support template strings
|
|
# viper_args: uses f(*)
|
|
exclude = [
|
|
"tests/basics/*.py",
|
|
"tests/*/repl_*.py",
|
|
"tests/cmdline/cmd_compile_only_error.py",
|
|
"tests/feature_check/tstring.py",
|
|
"tests/micropython/heapalloc_fail_tstring.py",
|
|
"tests/micropython/test_normalize_newlines.py",
|
|
"tests/micropython/viper_args.py",
|
|
]
|