Atexit fix#328
Conversation
|
@tartley do you might approving me? |
|
Hi there! Thanks for the contribution, this is going to be a great fix. I can't approve until we have a working test of some sort though. My motivation is that future contributors need some automated way for them to be notified if they make a change which completely breaks your change, so that we don't then deploy their broken change because we don't know about it. How about something like the following? The first test demonstrates the existing AttributeError handling, and the second one demonstrates the ValueError that you are adding: As always, you can tell whether these tests are actually working using TDD, or simulating a bit artifically in this case, since we already have the code changed:
|
|
Great idea, added. I tried something similar before but wasn't able to detach a StringIO - I clearly don't have your deep stream knowledge! |
|
I think this is just waiting a CI run, @tartley do you mind kicking it off? |
|
Thanks so much! I literally looked at this in an output today and thought back to this PR |
A library we use throws this annoying error when it's called in under certain conditions. It's probably doing something wrong, but I think
coloramashould be more resilient to this particular bad state. I've attached the script that demonstrates the error. I've tried to write a test for this, but the best I can to do honestly test the functionality is to spin up a new Python in a subprocess that callscolorama, this seems awkward and was difficult to make portable. If it's your desire I'll do it though.Before and after the fix:

Rejected test attempt: