How to use the pythonping.executor function in pythonping

To help you get started, we’ve selected a few pythonping examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alessandromaggio / pythonping / test / test_executor.py View on Github external
def responses_from_times(times):
        """Generates a list of empty responses from a list of time elapsed

        :param times: List of time elapsed for each response
        :type times: list
        :return: List of responses
        :rtype: executor.ResponseList"""
        return executor.ResponseList([executor.Response(None, _) for _ in times])
github alessandromaggio / pythonping / test / test_executor.py View on Github external
rs = executor.ResponseList([
            SuccessfulResponseMock(None, 1),
            FailingResponseMock(None, 1),
            FailingResponseMock(None, 1),
            FailingResponseMock(None, 1)
        ])
        self.assertTrue(
            rs.success(executor.SuccessOn.One),
            'Unable to calculate success on one correctly with one response successful'
        )
        self.assertFalse(
            rs.success(executor.SuccessOn.Most),
            'Unable to calculate success on most with one response successful'
        )
        self.assertFalse(
            rs.success(executor.SuccessOn.All),
            'Unable to calculate success on all with one response successful'
        )