mage
mage copied to clipboard
DEV: Auratouched Mage test fails randomly
The following test fails randomly. Something like 1-16 to 1-25 times. https://github.com/magefree/mage/blob/37f4f40a2c4962ce707521515de9c108bd16c003/Mage.Tests/src/test/java/org/mage/test/cards/abilities/other/AuratouchedMageTest.java#L35-L53
Changing the lands to dual lands improves that, but it will still fail.
[[Auratouched Mage]]
See #9391
Auratouched Mage - (Gatherer) (Scryfall) (EDHREC)
{5}{W} Creature — Human Wizard 3/3 When Auratouched Mage enters the battlefield, search your library for an Aura card that could enchant it. If Auratouched Mage is still on the battlefield, put that Aura card onto the battlefield attached to it. Otherwise, reveal the Aura card and put it into your hand. Then shuffle.
Maybe another aura is being used to attach to the Auratouched Mage.
Idk where it would come from. The test only has one aura
Is this another case of AI sometimes tapping the lands wrong? I feel like tests should always be deterministic rather than relying on an AI for anything. AIs often use RNG which is fine for actual gameplay... Not so much for tests that need to be consistent.
Is this another case of AI sometimes tapping the lands wrong? I feel like tests should always be deterministic rather than relying on an AI for anything. AIs often use RNG which is fine for actual gameplay... Not so much for tests that need to be consistent.
Nope. I tried replacing all of the lands with duals and it still fails
https://github.com/magefree/mage/commit/c8e1cec84663bd74cf50dc39de27040dfdc9513c
https://github.com/magefree/mage/commit/c8e1cec84663bd74cf50dc39de27040dfdc9513c
Does it no longer fail when you tell pycharm to run till failure?
c8e1cec
Still sometimes fails:
WARN 2022-09-25 21:36:02,888 Wrong target =>[main] TestPlayer.chooseTarget
Unused targets:
Relic Ward
java.lang.AssertionError: Missing TARGET def for turn 1, step PRECOMBAT_MAIN, PlayerA
Ability: Auratouched Mage - EntersBattlefieldTriggeredAbility: When {this} enters the battlefield, search your library for an Aura card that could enchant it. If {this} is still on the battlefield, put that Aura card onto the battlefield attached to it. Otherwise, reveal the Aura card and put it into your hand. Then shuffle.
Target: TargetCardInLibrary: Select up to one aura that could enchant Auratouched Mage
at org.junit.Assert.fail(Assert.java:89)
at org.mage.test.player.TestPlayer.chooseStrictModeFailed(TestPlayer.java:1956)
at org.mage.test.player.TestPlayer.chooseStrictModeFailed(TestPlayer.java:1930)
at org.mage.test.player.TestPlayer.chooseTarget(TestPlayer.java:2651)
at mage.target.common.TargetCardInLibrary.choose(TargetCardInLibrary.java:84)
at mage.players.PlayerImpl.searchLibrary(PlayerImpl.java:2734)
at mage.players.PlayerImpl.searchLibrary(PlayerImpl.java:2657)
at org.mage.test.player.TestPlayer.searchLibrary(TestPlayer.java:3527)
at mage.cards.a.AuratouchedMageEffect.apply(AuratouchedMage.java:71)
at mage.abilities.AbilityImpl.resolveMode(AbilityImpl.java:201)
at mage.abilities.AbilityImpl.resolve(AbilityImpl.java:185)
at mage.abilities.TriggeredAbilityImpl.resolve(TriggeredAbilityImpl.java:149)
at mage.game.stack.StackAbility.resolve(StackAbility.java:89)
at mage.game.GameImpl.resolve(GameImpl.java:1634)
at mage.game.GameImpl.playPriority(GameImpl.java:1560)
at mage.game.turn.Step.priority(Step.java:61)
at mage.game.turn.Phase.playStep(Phase.java:184)
at mage.game.turn.Phase.play(Phase.java:89)
at mage.game.turn.Turn.play(Turn.java:132)
at mage.game.GameImpl.playTurn(GameImpl.java:1055)
at mage.game.GameImpl.play(GameImpl.java:965)
at mage.game.GameImpl.start(GameImpl.java:941)
at org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl.execute(CardTestPlayerAPIImpl.java:280)
at org.mage.test.cards.abilities.other.AuratouchedMageTest.testAuratouchedMageEffectHasMadeIntoTypeArtifact(AuratouchedMageTest.java:49)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:30)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Fixing this by adding a second copy of Relic Ward to the library, since that was occasionally failing to be found for whatever reason. Passes 1000/1000 now without any failures.
Real fix in 38be371c253fd0a4330cbc28edb6d71ecf5a5064 due miss draw effect processing (that's why it's important to add all related effect texts to the test).
Argent Mutation has draw effect on resolve, so it was able to draw aura card before mage's resolve (library shuffled on game start, so it was a random result).
Library with good test result (draw will take a land):
Library with bad test result (draw will take an aura):