core: make option resolution in world tests deterministic (#2471)

Co-authored-by: Zach Parks <zach@alliware.com>
This commit is contained in:
el-u 2023-11-25 13:53:02 +01:00 committed by GitHub
parent 6dccf36f88
commit ba53278147
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1,8 +1,10 @@
import random
import sys
import typing
import unittest
from argparse import Namespace
from Generate import get_seed_name
from test.general import gen_steps
from worlds import AutoWorld
from worlds.AutoWorld import call_all
@ -152,6 +154,8 @@ class WorldTestBase(unittest.TestCase):
self.multiworld.player_name = {1: "Tester"}
self.multiworld.set_seed(seed)
self.multiworld.state = CollectionState(self.multiworld)
random.seed(self.multiworld.seed)
self.multiworld.seed_name = get_seed_name(random) # only called to get same RNG progression as Generate.py
args = Namespace()
for name, option in AutoWorld.AutoWorldRegister.world_types[self.game].options_dataclass.type_hints.items():
setattr(args, name, {