From 6609502fd8228025134b120c36f5e3867b1b841f Mon Sep 17 00:00:00 2001 From: Yan Date: Sun, 9 Nov 2025 18:59:17 +0100 Subject: [PATCH 1/2] feat(qase-pytest: commons): fix str env var comparing to int --- .../src/qase/commons/models/config/batch.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/qase-python-commons/src/qase/commons/models/config/batch.py b/qase-python-commons/src/qase/commons/models/config/batch.py index 2fa83f44..0d97b4c2 100644 --- a/qase-python-commons/src/qase/commons/models/config/batch.py +++ b/qase-python-commons/src/qase/commons/models/config/batch.py @@ -1,13 +1,23 @@ +from typing import Union + from ..basemodel import BaseModel class BatchConfig(BaseModel): - size: int = None + size: int def __init__(self): self.size = 200 - def set_size(self, size: int): - if size > 2000 or size == 0: + def set_size(self, size: Union[int, str]): + try: + if isinstance(size, str): + size = size.strip() + size_int = int(size) + else: + size_int = size + if size_int > 2000 or size_int == 0: + self.size = size_int + except ValueError: raise ValueError("Batch size should be greater than 0 and less than 2000") - self.size = size + From 4019d560a17e1266079bc165c8ae1bd98f45deb8 Mon Sep 17 00:00:00 2001 From: Yan Date: Sun, 9 Nov 2025 19:10:20 +0100 Subject: [PATCH 2/2] fix --- qase-python-commons/src/qase/commons/models/config/batch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qase-python-commons/src/qase/commons/models/config/batch.py b/qase-python-commons/src/qase/commons/models/config/batch.py index 0d97b4c2..53fd4354 100644 --- a/qase-python-commons/src/qase/commons/models/config/batch.py +++ b/qase-python-commons/src/qase/commons/models/config/batch.py @@ -19,5 +19,4 @@ def set_size(self, size: Union[int, str]): if size_int > 2000 or size_int == 0: self.size = size_int except ValueError: - raise ValueError("Batch size should be greater than 0 and less than 2000") - + raise ValueError("Batch size should be numeric value")