Changeset 25b14be in flex_extract.git for source/pythontest/TestInstall.py
- Timestamp:
- Sep 23, 2018, 11:40:28 AM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 4971f63
- Parents:
- 5d42acd
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
source/pythontest/TestInstall.py
r2fb99de r25b14be 2 2 # -*- coding: utf-8 -*- 3 3 4 import unittest 4 5 5 import sys 6 6 import os 7 7 import inspect 8 sys.path.append('../') 8 import pytest 9 10 sys.path.append('../python') 9 11 import _config 10 12 import install 11 from tools import make_dir13 from mods.tools import make_dir 12 14 13 15 14 class TestTools( unittest.TestCase):16 class TestTools(): 15 17 ''' 16 18 ''' 17 19 18 def setUp(self):19 pass20 20 21 21 # - main … … 30 30 # - make_convert_build 31 31 32 def test_mk_tarball (self):32 def test_mk_tarball_local(self): 33 33 import tarfile 34 34 … … 38 38 tar_test_dir = os.path.join(_config.PATH_TEST_DIR + 39 39 os.path.sep + 'TestInstallTar') 40 tar_test_fedir = os.path.join(tar_test_dir, 'flex_extract_v7.1') 41 42 comparison_list = [] 43 for path, subdirs, files in os.walk(tar_test_fedir): 44 for name in files: 45 if 'tar' not in name: 46 comparison_list.append(os.path.relpath(os.path.join(path, name), tar_test_fedir)) 40 tar_test_file = os.path.join(tar_test_dir, 41 'flex_extract_v7.1_local.tar') 42 with tarfile.open(tar_test_file, 'r') as tar_handle: 43 comparison_list = tar_handle.getnames() 47 44 48 45 # create test tarball and list its content files 49 tarballname = _config.FLEXEXTRACT_DIRNAME + '_test.tar' 50 install.mk_tarball(ecd + tarballname) 46 tarballname = _config.FLEXEXTRACT_DIRNAME + '_localtest.tar' 47 install.mk_tarball(ecd + tarballname, 'local') 48 with tarfile.open(ecd + tarballname, 'r') as tar_handle: 49 tar_content_list = tar_handle.getnames() 50 51 # remove test tar file from flex_extract directory 52 os.remove(ecd + tarballname) 53 54 # test if comparison filelist is equal to the 55 # filelist of tarball content 56 assert sorted(comparison_list) == sorted(tar_content_list) 57 58 def test_mk_tarball_ecgate(self): 59 import tarfile 60 61 ecd = _config.PATH_FLEXEXTRACT_DIR + os.path.sep 62 63 # list comparison files for tarball content 64 tar_test_dir = os.path.join(_config.PATH_TEST_DIR + 65 os.path.sep + 'TestInstallTar') 66 tar_test_file = os.path.join(tar_test_dir, 67 'flex_extract_v7.1_ecgate.tar') 68 with tarfile.open(tar_test_file, 'r') as tar_handle: 69 comparison_list = tar_handle.getnames() 70 71 # create test tarball and list its content files 72 tarballname = _config.FLEXEXTRACT_DIRNAME + '_ecgatetest.tar' 73 install.mk_tarball(ecd + tarballname, 'ecgate') 51 74 with tarfile.open(ecd + tarballname, 'r') as tar_handle: 52 75 tar_content_list = tar_handle.getnames() … … 68 91 tar_test_dir = os.path.join(_config.PATH_TEST_DIR + 69 92 os.path.sep + 'TestInstallTar') 70 tar_test_fedir = os.path.join(tar_test_dir, 'flex_extract_v7.1 ')93 tar_test_fedir = os.path.join(tar_test_dir, 'flex_extract_v7.1_ecgate') 71 94 comparison_list = [] 72 95 for path, subdirs, files in os.walk(tar_test_fedir): 73 96 for name in files: 74 97 if 'tar' not in name: 75 comparison_list.append(os.path.relpath(os.path.join(path, name), tar_test_fedir)) 98 comparison_list.append(os.path.relpath( 99 os.path.join(path, name), tar_test_fedir)) 76 100 77 101 # untar in test directory … … 79 103 make_dir(test_dir) 80 104 os.chdir(test_dir) 81 tarballname = _config.FLEXEXTRACT_DIRNAME + ' .tar'105 tarballname = _config.FLEXEXTRACT_DIRNAME + '_ecgate.tar' 82 106 install.un_tarball(os.path.join(tar_test_dir, tarballname)) 83 107 tarfiles_list = [] 84 108 for path, subdirs, files in os.walk(test_dir): 85 109 for name in files: 86 tarfiles_list.append(os.path.relpath(os.path.join(path, name), test_dir)) 110 tarfiles_list.append(os.path.relpath( 111 os.path.join(path, name), test_dir)) 87 112 88 113 # test for equality … … 91 116 # clean up temp test dir 92 117 shutil.rmtree(test_dir) 93 94 95 if __name__ == "__main__":96 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.