juan-leon / lowcharts

Tool to draw low-resolution graphs in terminal
MIT License
200 stars 5 forks source link

test: mark `configure_output` tests as `#[serial]` #29

Closed rrbutani closed 1 year ago

rrbutani commented 1 year ago

configure_output manipulates yansi::Color's global enable toggle; this state is not thread local so changes to it affect the whole program.

This causes the configure_output tests to fail (sporadically) when Cargo chooses to run tests in parallel and when the interleaving of configure_output tests results in Paint::enable being called between configure_output and .paint in another test.

Because we're dealing with a race condition there isn't a great way to reproduce the failures but running:

> until ! cargo test --jobs 10 ; do true; done

Reliably fails for me within a few runs.


Marking these tests with #[serial] (from the serial_test crate) fixes this.

Closes #28.

rrbutani commented 1 year ago

Oh whoops; I missed that @P1n3appl3 already filed an issue for this.

juan-leon commented 1 year ago

Thanks for your contribution!

I guess I can drop the --test-threads=1 in cargo test commands