Stardew Valley: Use classvar_matrix to split tests (#4762)
* Unroll tests for better parallelization * fix ut test * self review * bro it's the second time today I have to commit some garbage to have a github action rerun because messenger fails what is this * my god can the tests plz pass * code reviews * code reviews * move TestRandomWorlds out of long module
This commit is contained in:
@@ -1,28 +1,29 @@
|
||||
import unittest
|
||||
from typing import ClassVar
|
||||
|
||||
from BaseClasses import get_seed
|
||||
from .. import SVTestCase
|
||||
from test.param import classvar_matrix
|
||||
from .. import SVTestCase, solo_multiworld, skip_long_tests
|
||||
from ..assertion import WorldAssertMixin
|
||||
from ... import options
|
||||
|
||||
if skip_long_tests():
|
||||
raise unittest.SkipTest("Long tests disabled")
|
||||
|
||||
player_options = {
|
||||
options.EntranceRandomization.internal_name: options.EntranceRandomization.option_buildings,
|
||||
options.BundleRandomization.internal_name: options.BundleRandomization.option_remixed,
|
||||
options.BundlePrice.internal_name: options.BundlePrice.option_maximum
|
||||
}
|
||||
|
||||
|
||||
@classvar_matrix(n=range(1000))
|
||||
class TestGeneratePreRolledRandomness(WorldAssertMixin, SVTestCase):
|
||||
n: ClassVar[int]
|
||||
|
||||
def test_given_pre_rolled_difficult_randomness_when_generate_then_basic_checks(self):
|
||||
if self.skip_long_tests:
|
||||
raise unittest.SkipTest("Long tests disabled")
|
||||
seed = get_seed()
|
||||
|
||||
choices = {
|
||||
options.EntranceRandomization.internal_name: options.EntranceRandomization.option_buildings,
|
||||
options.BundleRandomization.internal_name: options.BundleRandomization.option_remixed,
|
||||
options.BundlePrice.internal_name: options.BundlePrice.option_maximum
|
||||
}
|
||||
|
||||
num_tests = 1000
|
||||
for i in range(num_tests):
|
||||
seed = get_seed() # Put seed in parameter to test
|
||||
with self.solo_world_sub_test(f"Entrance Randomizer and Remixed Bundles",
|
||||
choices,
|
||||
seed=seed,
|
||||
world_caching=False) \
|
||||
as (multiworld, _):
|
||||
self.assert_basic_checks(multiworld)
|
||||
print(f"Generating solo multiworld with seed {seed} for Stardew Valley...")
|
||||
with solo_multiworld(player_options, seed=seed, world_caching=False) as (multiworld, _):
|
||||
self.assert_basic_checks(multiworld)
|
||||
|
||||
Reference in New Issue
Block a user