skip to navigation
skip to content

MonitorRequests 0.0.0

Check remote calls via request

A tool to check for remote calls via the requests module.

Working on a large and complicated codebase with lot’s of slow unit tests? Suspect external API calls are slowing things down?

Here’s a quick tool for just that purpose.

Usage

import unittest
import monitor_requests
from example import example_method

class ExampleTestCase(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.monitor = monitor_requests.Monitor()

    @classmethod
    def tearDownClass(cls):
        print('External calls for example:')
        cls.monitor.report()
        cls.monitor.stop()

    def test_example_method(self):
        result = example_method()
        self.assertEqual(result.status_code, 200)

if __name__ == 'main':
    unittest.main()

Of course you can also set this up inside a test runner (or a session fixture if using py.test). You can also write to a file.

Installation

pip install MonitorRequests
 
File Type Py Version Uploaded on Size
MonitorRequests-0.0.0-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2017-06-26 4KB