aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreivanov89 <eivanov89@ydb.tech>2022-07-12 20:35:54 +0300
committereivanov89 <eivanov89@ydb.tech>2022-07-12 20:35:54 +0300
commitb45e6cd1ddfb0790202c31035f13acd3bfe33dd9 (patch)
treec4e6db6584ae4a52d7521e292edf20186cc74a21
parent54c6f2c3afcb14a298794f2d91af1071527d59d5 (diff)
downloadydb-b45e6cd1ddfb0790202c31035f13acd3bfe33dd9.tar.gz
fix flaky tests
-rw-r--r--library/python/pytest/plugins/collection.py13
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/test_env.cpp3
2 files changed, 12 insertions, 4 deletions
diff --git a/library/python/pytest/plugins/collection.py b/library/python/pytest/plugins/collection.py
index e36f47a78f..5ee0c621a7 100644
--- a/library/python/pytest/plugins/collection.py
+++ b/library/python/pytest/plugins/collection.py
@@ -1,6 +1,7 @@
import os
import sys
from six import reraise
+import logging
import py
@@ -37,7 +38,7 @@ class LoadedModule(_pytest.python.Module):
return self._getobj().__file__
else:
return self.name
-
+
@property
def nodeid(self):
return self._nodeid
@@ -46,7 +47,14 @@ class LoadedModule(_pytest.python.Module):
module_name = self.name[:-len('.py')]
if self.namespace:
module_name = '__tests__.' + module_name
- __import__(module_name)
+ try:
+ __import__(module_name)
+ except Exception as e:
+ msg = 'Failed to load module "{}" and obtain list of tests due to an error'.format(module_name)
+ logging.exception('%s: %s', msg, e)
+ etype, exc, tb = sys.exc_info()
+ reraise(etype, type(exc)('{}\n{}'.format(exc, msg)), tb)
+
return sys.modules[module_name]
@@ -70,7 +78,6 @@ class DoctestModule(LoadedModule):
runner=runner,
dtest=test)
except Exception:
- import logging
logging.exception('DoctestModule failed, probably you can add NO_DOCTESTS() macro to ya.make')
etype, exc, tb = sys.exc_info()
msg = 'DoctestModule failed, probably you can add NO_DOCTESTS() macro to ya.make'
diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
index 87c526d64d..750ed537c1 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
+++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
@@ -1012,5 +1012,6 @@ NSchemeShardUT_Private::TTestEnvOptions NSchemeShardUT_Private::TTestWithReboots
.EnablePipeRetries(false)
.EnableAsyncIndexes(true)
.EnableNotNullColumns(true)
- .EnableProtoSourceIdInfo(true);
+ .EnableProtoSourceIdInfo(true)
+ .DisableStatsBatching(true);
}