Beispiel #1
0
    def test_is_caffe_info_log_invalid_fname(self):

        fpath = os.path.join(self.dir_tmp,
                             "foo.hostname.username.log.ERROR.20150917-163712.31405")

        with open(fpath, 'w') as f:
            f.write('log file')

        assert_false(lu.is_caffe_info_log(fpath))
Beispiel #2
0
    def test_is_caffe_info_log_invalid_fname(self):

        fpath = os.path.join(
            self.dir_tmp,
            "foo.hostname.username.log.ERROR.20150917-163712.31405")

        with open(fpath, 'w') as f:
            f.write('log file')

        assert_false(lu.is_caffe_info_log(fpath))
Beispiel #3
0
    def test_read_pid_invalid(self):

        path_temp_dir = tempfile.mkdtemp()
        fpath = os.path.join(path_temp_dir, TEST_LOG_FILENAME)

        with open(fpath, 'w') as f:
            f.write('log file')

        assert_true(lu.is_caffe_info_log(fpath))

        fpath2 = os.path.join(path_temp_dir, "foo.txt")
        shutil.copyfile(fpath, fpath2)

        assert_raises(IOError, lu.read_pid, fpath2)

        shutil.rmtree(path_temp_dir)
Beispiel #4
0
    def test_read_pid_invalid(self):

        path_temp_dir = tempfile.mkdtemp()
        fpath = os.path.join(path_temp_dir, TEST_LOG_FILENAME)

        with open(fpath, 'w') as f:
            f.write('log file')

        assert_true(lu.is_caffe_info_log(fpath))

        fpath2 = os.path.join(path_temp_dir, "foo.txt")
        shutil.copyfile(fpath, fpath2)

        assert_raises(IOError, lu.read_pid, fpath2)

        shutil.rmtree(path_temp_dir)