Beispiel #1
0
def test_get_pid(config_root):
    config = Config(config_root)
    f = open(config.config_filename, "w")
    try:
        f.write("class Akara:\n  PidFile = %r\nMODULES=[]\n" % config.pid_filename)
    finally:
        f.close()
    try:
        commandline.get_pid(config)
        raise AssertionError("But the file does not exist!")
    except SystemExit, err:
        assert "Could not open Akara PID file" in str(err), err
        assert config.pid_filename in str(err), err
Beispiel #2
0
def test_get_pid(config_root):
    config = Config(config_root)
    f = open(config.config_filename, "w")
    try:
        f.write("class Akara:\n  PidFile = %r\nMODULES=[]\n" %
                config.pid_filename)
    finally:
        f.close()
    try:
        commandline.get_pid(config)
        raise AssertionError("But the file does not exist!")
    except SystemExit, err:
        assert "Could not open Akara PID file" in str(err), err
        assert config.pid_filename in str(err), err
Beispiel #3
0
    f = open(config.config_filename, "w")
    try:
        f.write("class Akara:\n  PidFile = %r\nMODULES=[]\n" %
                config.pid_filename)
    finally:
        f.close()
    try:
        commandline.get_pid(config)
        raise AssertionError("But the file does not exist!")
    except SystemExit, err:
        assert "Could not open Akara PID file" in str(err), err
        assert config.pid_filename in str(err), err

    config.save_pid("")
    try:
        commandline.get_pid(config)
    except SystemExit, err:
        assert "Empty Akara PID file" in str(err), err
        assert config.pid_filename in str(err), err

    config.save_pid("hello\n")
    try:
        commandline.get_pid(config)
    except SystemExit, err:
        assert "does not contain a PID" in str(err), err
        assert config.pid_filename in str(err), err

    config.save_pid("123\n")
    pid = commandline.get_pid(config)
    assert pid == 123
Beispiel #4
0
    config = Config(config_root)
    f = open(config.config_filename, "w")
    try:
        f.write("class Akara:\n  PidFile = %r\nMODULES=[]\n" % config.pid_filename)
    finally:
        f.close()
    try:
        commandline.get_pid(config)
        raise AssertionError("But the file does not exist!")
    except SystemExit, err:
        assert "Could not open Akara PID file" in str(err), err
        assert config.pid_filename in str(err), err

    config.save_pid("")
    try:
        commandline.get_pid(config)
    except SystemExit, err:
        assert "Empty Akara PID file" in str(err), err
        assert config.pid_filename in str(err), err

    config.save_pid("hello\n")
    try:
        commandline.get_pid(config)
    except SystemExit, err:
        assert "does not contain a PID" in str(err), err
        assert config.pid_filename in str(err), err

    config.save_pid("123\n")
    pid = commandline.get_pid(config)
    assert pid == 123