Skip to content

Replace curses.ascii.iscntrl#236

Closed
seproDev wants to merge 1 commit intofabiocaccamo:mainfrom
seproDev:no-curses
Closed

Replace curses.ascii.iscntrl#236
seproDev wants to merge 1 commit intofabiocaccamo:mainfrom
seproDev:no-curses

Conversation

@seproDev
Copy link
Copy Markdown
Contributor

@seproDev seproDev commented Jan 7, 2026


name: Pull request
about: Submit a pull request for this project
assignees: fabiocaccamo


Describe your changes
curses is not available in all python builds, most notably the official Windows builds. As it was only used in a single instance, I added the function as a util https://docs.python.org/3/library/curses.ascii.html#curses.ascii.iscntrl

Notably iscntrl and the re-implemention is only checking for ASCII control characters. I feel like checking for all Unicode control characters would make more sense? i.e. using unicodedata.category(char).startswith('C'). What do you think?

Related issue
?

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests for the proposed changes.
  • I have run the tests and there are not errors.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.27%. Comparing base (4a2b086) to head (842fb77).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #236   +/-   ##
=======================================
  Coverage   99.27%   99.27%           
=======================================
  Files           8        8           
  Lines         971      972    +1     
=======================================
+ Hits          964      965    +1     
  Misses          7        7           
Flag Coverage Δ
unittests 99.27% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@fabiocaccamo fabiocaccamo moved this to Todo in Open Source Jan 8, 2026
@fabiocaccamo fabiocaccamo added bug Something isn't working and removed bug Something isn't working labels Jan 8, 2026
@fabiocaccamo
Copy link
Copy Markdown
Owner

fabiocaccamo commented Jan 8, 2026

@seproDev I don't think this PR is necessary, tests are succesfully running also on Windows (thank you for fixing the unused matrix platform).

@fabiocaccamo fabiocaccamo added the invalid This doesn't seem right label Jan 8, 2026
@seproDev
Copy link
Copy Markdown
Contributor Author

seproDev commented Jan 8, 2026

@fabiocaccamo No the tests don't pass https://github.com/fabiocaccamo/python-fontbro/actions/runs/20835655396/job/59859704738#step:7:15

They only seem to pass in the CI because you reverted the change from pwsh to bash as I explained here #237 (comment)

@fabiocaccamo
Copy link
Copy Markdown
Owner

@seproDev tests fail only because curses has a separate dist for Windows, and forcing bash the wrong dist gets installed.

Try to add a specific unit test case that fails only on Windows if you want to double check if the CI works correctly.

@seproDev
Copy link
Copy Markdown
Contributor Author

seproDev commented Jan 9, 2026

@fabiocaccamo The linked CI run is from current main. The tests fail due to missing curses (look at the actual logs), but Github shows that the tests pass due to Github actions not aborting when a pwsh command exists with a non-zero exit code.
By using bash (the one shipped with git for Windows) this behaviour is consistent across operating system.

You can see this in the pipeline from my PR. Python for Windows is being installed and used. The test run fails the same way as current main, but Github now actually shows the pipeline as failing.

@fabiocaccamo fabiocaccamo added bug Something isn't working and removed invalid This doesn't seem right labels Jan 9, 2026
@fabiocaccamo
Copy link
Copy Markdown
Owner

@seproDev I fixed it without adding an utility method since that's used only there, you can upgrade to 0.26.1 version.

@github-project-automation github-project-automation Bot moved this from Todo to Done in Open Source Jan 9, 2026
@seproDev seproDev deleted the no-curses branch January 9, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants