Exemplo n.º 1
0
    def test_running(self):

        wc = WorkerConfiguration('worker_name', 'worker_id', 'username',
                                 'queue', 'platform', 'hostname', 'dist')

        self.assertFalse(wc.is_running())

        with wc.running():
            self.assertIsNotNone(wc.pid)
            self.assertTrue(wc.is_running())

        self.assertFalse(wc.is_running())
    def test_running(self):

        wc = WorkerConfiguration(
             'worker_name',
             'worker_id', 'username', 'queue',
             'platform', 'hostname', 'dist'
        )

        self.assertFalse(wc.is_running())

        with wc.running():
            self.assertIsNotNone(wc.pid)
            self.assertTrue(wc.is_running())

        self.assertFalse(wc.is_running())
Exemplo n.º 3
0
    def test_already_running(self):

        wc = WorkerConfiguration('worker_name', 'worker_id', 'username',
                                 'queue', 'platform', 'hostname', 'dist')

        self.assertFalse(wc.is_running())

        with wc.running():

            with self.assertRaises(errors.BinstarError):

                with wc.running():
                    pass

            self.assertTrue(wc.is_running())

        self.assertFalse(wc.is_running())
    def test_already_running(self):

        wc = WorkerConfiguration(
            'worker_name',
            'worker_id', 'username', 'queue',
            'platform', 'hostname', 'dist'
        )

        self.assertFalse(wc.is_running())

        with wc.running():

            with self.assertRaises(errors.BinstarError):

                with wc.running():
                    pass

            self.assertTrue(wc.is_running())

        self.assertFalse(wc.is_running())