Changeset efa05d7 in flex_extract.git
- Timestamp:
- Sep 2, 2018, 3:05:06 PM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 308e144
- Parents:
- 97e09f4
- Location:
- python
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
python/pythontest/.cache/v/cache/lastfailed
r97e09f4 refa05d7 1 1 { 2 2 "TestTools.py": true, 3 "TestTools.py::TestTools::()::test_failany_silent_remove": true, 3 4 "TestTools.py::TestTools::test_init128": true, 4 5 "TestTools.py::TestTools::test_to_param_id": true -
python/pythontest/TestTools.py
r97e09f4 refa05d7 7 7 import pipes 8 8 import pytest 9 from unittest.mock import patch 9 10 10 11 sys.path.append('../') 11 12 import _config 12 from tools import (init128, to_param_id, my_error, read_ecenv, 13 get_cmdline_arguments, submit_job_to_ecserver, 14 put_file_to_ecserver) 13 from tools import (get_cmdline_arguments, read_ecenv, clean_up, my_error, 14 normal_exit, product, silent_remove, init128, to_param_id, 15 get_list_as_string, make_dir, put_file_to_ecserver, 16 submit_job_to_ecserver) 15 17 16 18 … … 108 110 assert True 109 111 110 def test_silent_remove(self): 111 assert True 112 def test_success_silent_remove(self, capfd): 113 testfile = 'testfile.test' 114 open(testfile, 'w').close() 115 silent_remove(testfile) 116 out, err = capfd.readouterr() 117 assert os.path.isfile(testfile) == False 118 assert out == '' 119 120 def test_failnotexist_silent_remove(self, capfd): 121 testfile = 'testfile.test' 122 silent_remove(testfile) 123 out, err = capfd.readouterr() 124 assert os.path.isfile(testfile) == False 125 assert out == '' 126 127 @patch(silent_remove) 128 def test_failany_silent_remove(self, mock_silent_remove): 129 testfile = 'testfileany.test' 130 mock_silent_remove.side_effect = OSError 131 with pytest.raises(OSError) as pytest_wrapped_e: 132 silent_remove(testfile) 133 #out, err = capfd.readouterr() 134 #assert os.path.isfile(testfile) == False 135 #assert out == '' 112 136 113 137 def test_get_list_as_string(self): 114 138 assert True 115 139 116 def test_make_dir(self): 117 assert True 140 def test_warningexist_make_dir(self, capfd): 141 testdir = 'TestData' 142 make_dir(testdir) 143 out, err = capfd.readouterr() 144 assert out.strip() == 'WARNING: Directory {0} already exists!'.format(testdir) 145 146 def test_failany_make_dir(self): 147 testdir = '/test' # force a permission denied error 148 with pytest.raises(OSError) as pytest_wrapped_e: 149 make_dir(testdir) 150 assert pytest_wrapped_e.type == OSError 151 152 def test_success_make_dir(self): 153 testdir = 'testing_mkdir' 154 make_dir(testdir) 155 assert os.path.exists(testdir) == True 156 os.rmdir(testdir) 118 157 119 158 def test_fail_put_file_to_ecserver(self): -
python/tools.py
r97e09f4 refa05d7 316 316 ''' 317 317 @Description: 318 If "filename" exists , it is removed.318 Remove file if it exists. 319 319 The function does not fail if the file does not exist. 320 320 … … 329 329 os.remove(filename) 330 330 except OSError as e: 331 # this would be "except OSError, e:" before Python 2.6332 331 if e.errno != errno.ENOENT: 333 332 # errno.ENOENT = no such file or directory … … 427 426 @Input: 428 427 directory: string 429 The directory path which should be created.428 The directory name including the path which should be created. 430 429 431 430 @Return:
Note: See TracChangeset
for help on using the changeset viewer.