Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.9 KiB

# program to iinitialize the workspace
# pre: 1. program cloned
# 2. components are cloned, optional with path_const in config-folder
# post: 1. all folder are made with special name like components/const/path_const.py - otherwise with defaults
# 2. basic-configuration is created if it does not exist
# 3. necessary python-packages will be installed
# 4. git repos will be always updated
# -------------------------------------------------------------------------------------------------------------
"""
"""
import os
import basic.program
import tools.path_tool
import tools.file_tool
import basic.constants as B
# look if the path-constanst are specific defined.
home = os.getcwd()
if os.path.exists(os.path.join(home, "components", "config", "path_const.py")):
import components.config.path_const as P
else:
import tools.path_const as P
# import always the keyword.
import tools.path_const as Q
print("# ----------------------------------------------------------------------------------- ")
dirs = {}
dirs[Q.ATTR_PATH_HOME] = home
dirs[Q.ATTR_PATH_PROGRAM] = home
dirs[Q.ATTR_PATH_COMPONENTS] = os.path.join(home, "components")
pval = [P.ATTR_PATH_ARCHIV, P.ATTR_PATH_ENV, P.ATTR_PATH_DEBUG, P.ATTR_PATH_TEMP]
qkey = [Q.ATTR_PATH_ARCHIV, Q.ATTR_PATH_ENV, Q.ATTR_PATH_DEBUG, Q.ATTR_PATH_TEMP]
dirkey = [Q.ATTR_PATH_PROGRAM, Q.ATTR_PATH_COMPONENTS, Q.ATTR_PATH_HOME, Q.VAL_BASE_DATA] + qkey
home = tools.path_tool.getHome()
print("mkdirs in home " + home)
dirname = os.path.join(home, P.VAL_BASE_DATA)
dirs[Q.VAL_BASE_DATA] = dirname
if not os.path.exists(dirname):
os.makedirs(dirname, exist_ok=True)
print(" - "+dirname)
else:
print(" - " + dirname + " exists ")
dirname = os.path.join(home, P.VAL_CONFIG)
if not os.path.exists(dirname):
os.makedirs(dirname, exist_ok=True)
print(" - "+dirname)
else:
print(" - " + dirname + " exists ")
for i in range(0, len(pval)):
dirname = os.path.join(home, P.VAL_BASE_DATA, pval[i])
dirs[qkey[i]] = dirname
if not os.path.exists(dirname):
os.makedirs(dirname, exist_ok=True)
print(" - "+dirname)
else:
print(" - " + dirname + " exists ")
print("\n# ----------------------------------------------------------------------------------- ")
for format in ["yml", "json", "xml"]:
filename = os.path.join(home, Q.VAL_CONFIG, B.BASIS_FILE+"."+format)
if os.path.isfile(filename):
break
filename = ""
if len(filename) < 1:
filename = os.path.join(home, Q.VAL_CONFIG, B.BASIS_FILE+".yml")
text = "basic:\n"
text += " language: en\n"
text += " paths:\n"
for d in dirkey:
text += " "+d+": "+dirs[d]+"\n"
print(text)
print(filename)
with open(filename, 'w') as file:
file.write(text)
file.close()
print("create basis-config in "+filename)
print(text)
else:
print("basis-config exists "+filename)
print("\n# ----------------------------------------------------------------------------------- ")
print("please install requirements ")
# install requirements
# sudo apt install python3.10-venv
# python3 -m venv venv
# . venv/bin/activate
# pip install Flask
job = basic.program.Job("unit")
print("\n# ----------------------------------------------------------------------------------- ")
import tools.git_tool
for repo in ["program", "components", "testdata"]:
tools.git_tool.gitPull(job, repo)
print("\n# ----------------------------------------------------------------------------------- ")
if "db" in job.conf:
import basic.connection
entity = basic.connection.Connection(job)
entity.createSchema()
import model.testcase
entity = model.testcase.Testcase(job)
entity.createSchema()
import model.testsuite
entity = model.testsuite.Testsuite(job)
entity.createSchema()
import model.testplan
entity = model.testplan.Testplan(job)
entity.createSchema()
import basic.testexecution
entity = basic.testexecution.Testexecution(job)
entity.createSchema()