]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/snap_schedule: fix imports for snap_schedule vs mgr wide tox runs 29489/head
authorJan Fajerski <jfajerski@suse.com>
Wed, 12 Aug 2020 10:58:29 +0000 (12:58 +0200)
committerJan Fajerski <jfajerski@suse.com>
Thu, 27 Aug 2020 13:55:46 +0000 (15:55 +0200)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
src/pybind/mgr/snap_schedule/__init__.py
src/pybind/mgr/snap_schedule/fs/schedule.py
src/pybind/mgr/snap_schedule/tox.ini

index 843b447f54071be3830e1271c4ccda6a9a89bd0a..8001b7184851d7ee5fb519af172dd1ec6db14c80 100644 (file)
@@ -2,7 +2,10 @@
 
 from os import environ
 
-if 'UNITTEST' in environ:
+if 'SNAP_SCHED_UNITTEST' in environ:
     import tests
+elif 'UNITTEST' in environ:
+    import tests
+    from .module import Module
 else:
     from .module import Module
index cee7a3c763d9cfcf9124f8c54707ee1d87879f1b..019d28caa2d3946c4847a465220de29c8e649983 100644 (file)
@@ -14,6 +14,9 @@ from typing import Tuple, Any
 log = logging.getLogger(__name__)
 
 
+TESTING = 'SNAP_SCHED_TESTING' in environ
+
+
 # Work around missing datetime.fromisoformat for < python3.7
 SNAP_DB_TS_FORMAT = '%Y-%m-%dT%H:%M:%S'
 try:
@@ -354,7 +357,7 @@ class Schedule(object):
     def repeat(self):
         mult = self.schedule[-1]
         period = int(self.schedule[0:-1])
-        if 'SNAP_SCHED_TESTING' in environ and mult == 'M':
+        if TESTING and mult == 'M':
             return period * 60
         elif mult == 'h':
             return period * 60 * 60
index 756dc044bdcd899b29026c43386f27e3cabb519a..fbf894b068eecdf751adbe13005792d06d064664 100644 (file)
@@ -10,7 +10,7 @@ setenv=
     PATH = {toxinidir}/../../../../build/bin:$PATH
     py27: PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.2:..
     py3:  PYTHONPATH = {toxinidir}/../../../../build/lib/cython_modules/lib.3:{toxinidir}
-    UNITTEST = true
+    SNAP_SCHED_UNITTEST = true
 deps =
     pytest
     mock