From 38fef71f61fa598bfe040d3b9725a78c606facee Mon Sep 17 00:00:00 2001 From: yurekami Date: Sat, 25 Apr 2026 17:34:04 +0800 Subject: [PATCH] fix(tests/pytest_random_plugin.py): also seed Python's `random` The autouse `seed` fixture seeds torch but not Python's `random`. Tests that go through `tile_kernels/testing/generator.py:generate_rand_float` draw the magnitude exponent from `random.randint(-110, 126)`, so the input scale varies across runs even when --seed is fixed. Add `random.seed(seed)` so --seed is fully reproducible. --- tests/pytest_random_plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/pytest_random_plugin.py b/tests/pytest_random_plugin.py index 8726e2c..0f5071f 100644 --- a/tests/pytest_random_plugin.py +++ b/tests/pytest_random_plugin.py @@ -1,4 +1,5 @@ import hashlib +import random import pytest import torch @@ -15,4 +16,5 @@ def seed(request): ).hexdigest(), 16) % (2**31) seed = base + node_hash torch.manual_seed(seed) + random.seed(seed) return seed