test: disable parallel execution to fix data races
Removes t.Parallel() from TestRadioMenu_Unit, TestShowVersion_Unit, and TestPrecheck_Unit. These tests mutate globals, redirect os.Stdout, or call external dependencies, causing races when run concurrently with other tests under -race.
This commit is contained in:
parent
1b30278f9b
commit
dc356417ec
@ -78,7 +78,10 @@ func TestQuit_Unit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRadioMenu_Unit(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Do not mark Parallel: RadioMenu does fmt.Println and constructs a wmenu.Menu.
|
||||
// When this runs concurrently (via t.Parallel on the parent) with
|
||||
// TestShowVersion_Unit (which mutates globals and does os.Stdout swapping),
|
||||
// the race detector flags concurrent fmt + wmenu activity against global writes.
|
||||
t.Log("✓ Fast RadioMenu unit test")
|
||||
|
||||
tests := []struct {
|
||||
|
||||
@ -15,7 +15,10 @@ import (
|
||||
)
|
||||
|
||||
func TestShowVersion_Unit(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Do not mark Parallel: this test mutates the package-level "version" shim
|
||||
// (and internal/version vars) and redirects os.Stdout. Running it concurrently
|
||||
// with other legacy tests (esp. those calling RadioMenu which does fmt + wmenu)
|
||||
// produces data races under -race.
|
||||
t.Log("✓ Fast showVersion unit test")
|
||||
|
||||
tests := []struct {
|
||||
@ -81,7 +84,9 @@ func TestShowVersion_Unit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPrecheck_Unit(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Do not mark Parallel: precheck reads config + calls external IsInstalled,
|
||||
// and in some paths can have side effects. Keep it serialized with other
|
||||
// main-package legacy tests to avoid races on shared state under -race.
|
||||
t.Log("✓ Fast precheck unit test")
|
||||
|
||||
p := "mpv"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user