def setUpModule():
    """
    Prepare the test suite.

    Sets up logging to the terminal. When a test fails the logging output can
    help to perform a post-mortem analysis of the failure in question (even
    when its hard to reproduce locally). This is especially useful when
    debugging remote test failures, whether they happened on Travis CI or a
    user's local system.

    Also makes sure that the Apache web server is installed and running because
    this is required to run the test suite.
    """
    # Set up logging to the terminal.
    coloredlogs.install(level=logging.DEBUG)
    # Make sure Apache is installed and configured.
    try:
        manager = ApacheManager()
        manager.fetch_status_page(manager.text_status_url)
    except Exception as e:
        logger.exception("Failed to connect to local Apache server!")
        raise Exception(
            compact("""
            Please make sure the Apache web server is installed and configured
            (running) before you run this test suite because this test suite
            tests the actual integration with Apache (it doesn't use mocking)
            and so requires Apache to be installed, configured and running.

            Swallowed exception: {message} ({type})
        """,
                    message=e,
                    type=type(e)))
示例#2
0
def setUpModule():
    """
    Prepare the test suite.

    Sets up logging to the terminal. When a test fails the logging output can
    help to perform a post-mortem analysis of the failure in question (even
    when its hard to reproduce locally). This is especially useful when
    debugging remote test failures, whether they happened on Travis CI or a
    user's local system.

    Also makes sure that the Apache web server is installed and running because
    this is required to run the test suite.
    """
    # Set up logging to the terminal.
    coloredlogs.install(level=logging.DEBUG)
    # Make sure Apache is installed and configured.
    try:
        manager = ApacheManager()
        manager.fetch_status_page(manager.text_status_url)
    except Exception as e:
        logger.exception("Failed to connect to local Apache server!")
        raise Exception(compact("""
            Please make sure the Apache web server is installed and configured
            (running) before you run this test suite because this test suite
            tests the actual integration with Apache (it doesn't use mocking)
            and so requires Apache to be installed, configured and running.

            Swallowed exception: {message} ({type})
        """, message=e, type=type(e)))
 def test_memory_usage(self):
     """Test that memory usage analysis works."""
     manager = ApacheManager()
     # Make sure there are Apache workers alive that have handled a couple of requests.
     for i in range(10):
         manager.fetch_status_page(manager.text_status_url)
     assert sum(manager.memory_usage) > 0
     # TODO Create a WSGI process group so we can perform a useful test here?
     assert isinstance(manager.wsgi_process_groups, dict)
示例#4
0
 def test_memory_usage(self):
     """Test that memory usage analysis works."""
     manager = ApacheManager()
     # Make sure there are Apache workers alive that have handled a couple of requests.
     for i in range(10):
         manager.fetch_status_page(manager.text_status_url)
     assert sum(manager.memory_usage) > 0
     # TODO Create a WSGI process group so we can perform a useful test here?
     assert isinstance(manager.wsgi_process_groups, dict)