#+STARTUP: indent
-#+TODO: BACKLOG READY RED GREEN REFACTOR LINT L10N BUILD BLOG | DONE
+#+TODO: BACKLOG READY DOING | DONE
#+CATEGORY: pmachines
#+TAGS: bug(b) calendar(c) waiting(w)
-* BLOG write the blog post for q3
+* DOING unit test main.py
+* READY unit test: completeness of l10n
+* READY unit test: no errors from pyflakes
* BACKLOG intro animation (from target item to start position)
* BACKLOG buttons of the scenes enabled sequentially
- [ ] each scene has a version
--- /dev/null
+from pathlib import Path
+import sys
+if '' in sys.path: sys.path.remove('')
+sys.path.append(str(Path(__file__).parent.parent.parent))
+from os import remove
+from os.path import exists
+from unittest import TestCase
+from setuptools.dist import Distribution
+from setup import AbsCmd
+from ya2.build.build import exec_cmd
+from main import Main
+import logging
+from ya2.utils.dictfile import DctFile
+import importlib
+import main
+
+
+class MainTests(TestCase):
+
+ def setUp(self):
+ self.__optfile = DctFile('options.ini')
+ self.__verbose_val = self.__optfile['development']['verbose_log']
+
+ def tearDown(self):
+ self.__optfile['development']['verbose_log'] = self.__verbose_val
+ self.__optfile.store()
+
+ def test_logging(self):
+ self.assertEqual(logging.root.handlers[0].formatter._fmt, '%(asctime)s %(message)s')
+ self.assertEqual(logging.root.handlers[0].formatter.datefmt, '%H:%M:%S')
+ self.__optfile['development']['verbose_log'] = 0
+ self.__optfile.store()
+ importlib.reload(main)
+ self.assertEqual(logging.root.level, logging.INFO)
+ self.__optfile['development']['verbose_log'] = 1
+ self.__optfile.store()
+ importlib.reload(main)
+ self.assertEqual(logging.root.level, logging.DEBUG)