Ejemplo n.º 1
0
    def test_read_pid(self):

        fpath = os.path.join(os.path.dirname(ROOT_PKG_PATH), TEST_DATA_DIRNAME,
                             TEST_LOG_FILENAME)

        result = lu.read_pid(fpath)
        assert_is_instance(result, int)
        assert_equal(result, 31405)
Ejemplo n.º 2
0
    def test_read_pid(self):

        fpath = os.path.join(os.path.dirname(ROOT_PKG_PATH),
                             TEST_DATA_DIRNAME,
                             TEST_LOG_FILENAME)

        result = lu.read_pid(fpath)
        assert_is_instance(result, int)
        assert_equal(result, 31405)
Ejemplo n.º 3
0
    def test_read_pid_from_content(self):

        fpath = os.path.join(os.path.dirname(ROOT_PKG_PATH), TEST_DATA_DIRNAME,
                             TEST_LOG_FILENAME)

        path_temp_dir = tempfile.mkdtemp()

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

        shutil.copyfile(fpath, fpath2)

        try:

            assert_less(lu.pid_from_logname(fpath2), 0)

            result = lu.read_pid(fpath2)
            assert_is_instance(result, int)
            assert_equal(result, 31405)

        except Exception:
            pass
        shutil.rmtree(path_temp_dir)
Ejemplo n.º 4
0
    def test_read_pid_from_content(self):

        fpath = os.path.join(os.path.dirname(ROOT_PKG_PATH),
                             TEST_DATA_DIRNAME,
                             TEST_LOG_FILENAME)

        path_temp_dir = tempfile.mkdtemp()

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

        shutil.copyfile(fpath, fpath2)

        try:

            assert_less(lu.pid_from_logname(fpath2), 0)

            result = lu.read_pid(fpath2)
            assert_is_instance(result, int)
            assert_equal(result, 31405)

        except Exception:
            pass
        shutil.rmtree(path_temp_dir)