Refactored sheerka class: splitted to use sub handlers. Refactored unit tests to use classes.

This commit is contained in:
2020-01-22 17:49:28 +01:00
parent 821614a6c4
commit c489a38ebc
120 changed files with 7947 additions and 8190 deletions
+34
View File
@@ -0,0 +1,34 @@
import os
import shutil
from os import path
import pytest
from core.sheerka.Sheerka import Sheerka
from tests.BaseTest import BaseTest
class TestUsingFileBasedSheerka(BaseTest):
tests_root = path.abspath("../../build/tests")
root_folder = "init_folder"
@pytest.fixture(autouse=True)
def init_test(self):
if path.exists(self.tests_root):
shutil.rmtree(self.tests_root)
if not path.exists(self.tests_root):
os.makedirs(self.tests_root)
current_pwd = os.getcwd()
os.chdir(self.tests_root)
yield None
os.chdir(current_pwd)
def get_sheerka(self, use_dict=True, skip_builtins_in_db=True):
root = "mem://" if use_dict else self.root_folder
sheerka = Sheerka(skip_builtins_in_db=skip_builtins_in_db)
sheerka.initialize(root)
return sheerka