tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
3.02k stars 252 forks source link

Silence stderr in tests #1708

Closed jotaen4tinypilot closed 9 months ago

jotaen4tinypilot commented 9 months ago

Resolves https://github.com/tiny-pilot/tinypilot/issues/1642: our test output is nice and tidy again.

Contrary to what I initially mentioned in the ticket, one of the two stacktraces didn’t come from test_process_with_result_child_exception, which already had the “stderr silencing”, but rather from test_background_thread_ignores_function_exception. (I’ve updated the ticket accordingly.)

The “stderr silencing” technique is working fine, we just didn’t have it on the other two functions. These were added later, so we likely just forgot about this issue.

I’ve extracted a context manager function, to make it easier to discover and re-use this technique in the tests, and to avoid us having to repeat the explanatory comment + exact invocation again and again. Review on CodeApprove

jotaen4tinypilot commented 9 months ago

(My response from CodeApprove doesn’t show up, so copying over for now.)

@jdeanwallace Oh, that’s weird… Did you run the tests on MacOS by any chance? I can confirm that I too see it when running on MacOS directly, but it looks alright in my Linux dev VM. I’m suspecting that this might be a Mac issue, similar (or related) to the forking vs. spawning thing.

I’ll give this a shot and see whether we can make it work on Mac in an easy and timely manner.