josueBarretogit / manga-tui

Terminal-based manga reader and downloader with image support
https://crates.io/crates/manga-tui
MIT License
443 stars 12 forks source link

Test failure on Arch Linux in a clean chroot #23

Open orhun opened 3 weeks ago

orhun commented 3 weeks ago

Hey, I got the following error while building the AUR package from the latest version:

failures:

---- backend::filter::test::filters_combined_work stdout ----
thread 'backend::filter::test::filters_combined_work' panicked at src/backend/filter.rs:349:34:
an error ocurred when setting preferred language
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    backend::filter::test::filters_combined_work

Also I get similar failures in other tests:

---- view::widgets::filter_widget::state::test::language_filter_list_works stdout ----
thread 'view::widgets::filter_widget::state::test::language_filter_list_works' panicked at src/backend/filter.rs:349:34:
an error ocurred when setting preferred language

---- view::widgets::filter_widget::state::test::filter_state stdout ----
thread 'view::widgets::filter_widget::state::test::filter_state' panicked at src/backend/filter.rs:349:34:
an error ocurred when setting preferred language
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- view::pages::search::test::search_page_key_events stdout ----
thread 'view::pages::search::test::search_page_key_events' panicked at src/backend/filter.rs:349:34:
an error ocurred when setting preferred language

---- view::pages::manga::test::handle_key_events stdout ----
thread 'view::pages::manga::test::handle_key_events' panicked at src/backend/filter.rs:349:34:
an error ocurred when setting preferred language

failures:
    view::pages::manga::test::handle_key_events
    view::pages::search::test::search_page_key_events
    view::widgets::filter_widget::state::test::filter_state
    view::widgets::filter_widget::state::test::language_filter_list_works

I'm not sure why it's failing but I thought it'd be best to report it here. Any ideas?

In the meantime I skipped the backend tests as a workaround.

josueBarretogit commented 3 weeks ago

I'm using global variables with once_cell so this error are because the same variable is being set multiple times, I run cargo test -- --test-threads=1 and it works, of course this isn't correct seems like an anti-pattern so Im planning on using rstests and of course improve / add missing tests

orhun commented 3 weeks ago

Thanks for the tip! I used --test-threads=1 and re-pushed the package.

of course this isn't correct seems like an anti-pattern so Im planning on using rstests and of course improve / add missing tests

Yeah, definitely!