Esempio n. 1
0
def test_create_crontab(tmpdir, monkeypatch):
    monkeypatch.setattr(py.path.local, "sysexec", lambda x, y: "")
    tw = py.io.TerminalWriter()
    devpictl = tmpdir.join("devpi-ctl")
    if py.path.local.sysfind("crontab"):
        cron = gendeploy.create_crontab(tw, tmpdir, devpictl)
        assert cron
        expect = "crontab %s" % tmpdir.join("crontab")
        assert expect in cron
        assert "@reboot" in tmpdir.join("crontab").read()
    else:
        pytest.skip('crontab not installed')
Esempio n. 2
0
def test_create_crontab(tmpdir, monkeypatch):
    monkeypatch.setattr(py.path.local, "sysexec", lambda x, y: "")
    tw = py.io.TerminalWriter()
    path = tmpdir.join("devpi-ctl")
    if py.path.local.sysfind("crontab"):
        cron = gendeploy.create_crontab(tw, tmpdir, path)
        assert cron
        expect = "crontab %s" % tmpdir.join("crontab")
        assert expect in cron
        assert "@reboot" in tmpdir.join("crontab").read()
    else:
        pytest.skip('crontab not installed')
Esempio n. 3
0
def test_create_crontab_empty(tmpdir, monkeypatch):
    def sysexec_raise(x, y):
        raise py.process.cmdexec.Error(1, 2, x, "", "")

    monkeypatch.setattr(py.path.local, "sysexec", sysexec_raise)
    tw = py.io.TerminalWriter()
    devpictl = tmpdir.join("devpi-ctl")
    if py.path.local.sysfind("crontab"):
        cron = gendeploy.create_crontab(tw, tmpdir, devpictl)
        assert cron
        expect = "crontab %s" % tmpdir.join("crontab")
        assert expect in cron
        assert "@reboot" in tmpdir.join("crontab").read()
    else:
        pytest.skip('crontab not installed')
Esempio n. 4
0
def test_create_crontab_empty(tmpdir, monkeypatch):
    def sysexec_raise(x, y):
        raise py.process.cmdexec.Error(1, 2, x, "", "")

    monkeypatch.setattr(py.path.local, "sysexec", sysexec_raise)
    tw = py.io.TerminalWriter()
    path = tmpdir.join("devpi-ctl")
    if py.path.local.sysfind("crontab"):
        cron = gendeploy.create_crontab(tw, tmpdir, path)
        assert cron
        expect = "crontab %s" % tmpdir.join("crontab")
        assert expect in cron
        assert "@reboot" in tmpdir.join("crontab").read()
    else:
        pytest.skip('crontab not installed')