| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- from distutils.dir_util import copy_tree
- import os
- import sys
- import file
- import utilities
- print("\n** PREPARATION **")
- if not file.fexists("..\\OpenAccess.accda"):
- print("unzip OpenAccess.zip in .\\work")
- os.system("unzip -q ..\\OpenAccess.zip -d .\\work")
- for subdir in (".\\work", ".\\results"):
- if file.fexists(subdir):
- print("clean "+subdir)
- file.frmdir(os.path.abspath(subdir))
- else:
- print("make dir "+subdir)
- file.fmkdir(os.path.abspath(subdir))
- for zipped_file in ("project0.zip", "db.zip", "empty_project.zip"):
- print("unzip .\\initial\\{} to .\\work".format(zipped_file))
- os.system("unzip -q .\\initial\\{} -d .\\work".format(zipped_file))
- utilities.clean_sources(".\\reference\\source")
- print("\n** TEST EXPORT **")
- accdb_path = ".\\work\\project0.accdb"
- print("Export the sources from " + accdb_path)
- os.system( accdb_path + " /X test_export" )
- print("Verify the log file")
- result = utilities.verify_log(".\\work\\project0_1.log")
- if result != 0:
- sys.exit(result)
- utilities.clean_sources( ".\\work\\source\\" )
- zipped_project0 = ".\\work\\project0.zip"
- print("control existence of " + zipped_project0)
- if not file.fexists( zipped_project0 ):
- print( zipped_project0 +" does not exist" )
- sys.exit(1)
- source = ".\\work\\source"
- target = ".\\results\\source1"
- print("Copy {} to {}".format(source, target))
- copy_tree(source, target)
- print("control the result")
- result = utilities.compare_dirs( ".\\results\\source1", ".\\reference\\source" )
- if result != 0:
- sys.exit(result)
- print(".\\results\\source1 and .\\reference\\source are identical")
- print("\n** TEST IMPORTS **")
- import_project = ".\\work\\empty_project.accdb"
- print("Import .\\work\\sources in " + import_project)
- os.system(import_project + " /X test_import")
- print("Verify the log file")
- result = utilities.verify_log(".\\work\\empty_project_1.log")
- if result != 0:
- sys.exit(result)
- print("copy {} to {}".format(import_project, ".\\results\\empty_project_updated.accdb"))
- file.fcopy(import_project, ".\\results\\empty_project_updated.accdb")
- print("control existence of backup")
- if not file.fexists(import_project + ".old"):
- print(import_project + ".old do not exist")
- sys.exit(1)
- print("** end **")
- sys.exit(0)
|