SotMSteamMods / CauldronMods

Mod adaptations of the Cauldron decks for Sentinels of the Multiverse for Steam Workshop
MIT License
15 stars 9 forks source link

Fix flaky tests 4/10/24 #1685

Open origamiswami opened 7 months ago

origamiswami commented 7 months ago

More fixes for flaky tests.

I also found a bug with BaseTest.GetCard() that affects a bunch of tests, especially for Baccarat. If GetCard is used with the "index" parameter to get different copies of the card, and if all or all but one of the copies of that card are in the hero's hand, GetCard will return the same copy of the card regardless of the index used. In the test TestBringDownTheHouseShufflePair, if this happens with Cheap Trick, then only one copy of Cheap Trick will get moved to the trash instead of two copies, and the test will fail. I estimate the chances of this happening with a 4-copy card as ~0.1%, but it still happens sometimes. I'm not sure how many tests this affects, or what the best way to fix this is. This can be fixed by adding conditions to GetCard to make sure it grabs a different copy of the card, but we might need to do that to a LOT of tests. It might be easier to modify GetCard to avoid the bug, but that risks breaking other tests.

TestMentalLink_PlayCardWhenVillainCardIsPlayed was also flaky, but I couldn't tell what it was supposed to be testing, so I didn't modify it.