コード例 #1
0
ファイル: test_runner.py プロジェクト: davidwilemski/ginkgo
def test_runner_no_daemonize():
    from ginkgo.runner import Runner
    class EmptyRunner(Runner):
        def run(self): pass
    EmptyRunner._args = ['start', '-C', 'config', '-n']
    EmptyRunner._opener = mock_open({'{}/config'.format(os.getcwd()): "", "serviced.log": "", "serviced.pid": ""})
    with silencer():
        EmptyRunner()
コード例 #2
0
ファイル: test_runner.py プロジェクト: davidwilemski/ginkgo
def test_extend_file_config_option():
    from ginkgo.runner import Runner
    from ginkgo.config import Setting

    class ConfigCheckRunner(Runner):
        foo = Setting('foo')
        def run(self):
            assert self.foo == 'bar2'

    ConfigCheckRunner._args = ['run', '-C', 'config1', '-X', "foo = 'bar2'"]
    ConfigCheckRunner._opener = mock_open({'{}/config1'.format(os.getcwd()): "foo = 'bar1'"})

    with silencer():
        ConfigCheckRunner().do_action()
コード例 #3
0
ファイル: test_runner.py プロジェクト: davidwilemski/ginkgo
def test_command_line_override_config():
    """ Test that specifying an option on the command line override any
        value set in a config file"""
    from ginkgo.runner import Runner

    class ConfigCheckRunner(Runner):
        def run(self):
            assert self.pidfile_path == 'mypidfile.pid'

    ConfigCheckRunner._args = ['run', '-C', 'config', '-p', 'mypidfile.pid']
    ConfigCheckRunner._opener = mock_open({'{}/config'.format(os.getcwd()): "pidfile = 'configpidfile.pid'"})

    with silencer():
        ConfigCheckRunner().do_action()
コード例 #4
0
ファイル: test_runner.py プロジェクト: davidwilemski/ginkgo
def test_runner_action_required():
    from ginkgo.runner import Runner
    Runner._args = []
    with silencer():
        Runner()
コード例 #5
0
ファイル: test_runner.py プロジェクト: davidwilemski/ginkgo
def test_runner_reads_config():
    from ginkgo.runner import Runner
    Runner._args = ['start', '-C', 'config']
    Runner._opener = mock_open({'{}/config'.format(os.getcwd()): "", "serviced.log": ""})
    with silencer():
        Runner()
コード例 #6
0
ファイル: test_runner.py プロジェクト: davidwilemski/ginkgo
def test_runner_config_required():
    from ginkgo.runner import Runner
    Runner._args = ['start']
    with silencer():
        Runner()