From 2560aa709c08794a2fdc77b918bb3bf524bb1382 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Thu, 30 Mar 2023 08:28:59 +0200 Subject: [PATCH] tests: Use proper random object for string generation PyOCF needs to control random seed, to allow running tests with pytest-xdist. Use local random object initialized with seed from the config. Signed-off-by: Robert Baldyga --- tests/functional/tests/utils/random.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/tests/utils/random.py b/tests/functional/tests/utils/random.py index 2b58578..0ec2260 100644 --- a/tests/functional/tests/utils/random.py +++ b/tests/functional/tests/utils/random.py @@ -1,5 +1,5 @@ # -# Copyright(c) 2019-2021 Intel Corporation +# Copyright(c) 2019-2023 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -79,7 +79,7 @@ class RandomStringGenerator: *extra_chars, ]: yield "".join( - random.choice(t) + self.random.choice(t) for _ in range(self.random.randint(len_range.min, len_range.max)) )