view _ui_tests/conftest.py @ 2860:233d63abbdaf

reorder modernized blog.css rules to match basic blog.css sequence no code changes, rules remain unnecessarily inconsistent
author RogerHaase <haaserd@gmail.com>
date Tue, 02 Dec 2014 14:21:32 -0700
parents 181a556a0920
children
line wrap: on
line source
# Copyright: 2012 MoinMoin:HughPerkins
# License: GNU GPL v3 (or any later version), see LICENSE.txt for details.

"""
Contains events called by py.test during the life-cycle of the test suite
This module is automatically loaded by py.test, which looks for a file
of this name
"""

import os
import sys

sys.path.append(os.path.dirname(__file__))
import driver_register


def pytest_runtest_makereport(item, call):
    """
    Entry point for event which occurs after each test has run
    The parameters are:
    - item: the method called
    - call: an object of type CallInfo, which has two properties, of which
      excinfo contains info about any exception that got thrown by the method
    This method is called automatically by py.test.  The name of the method
    is used by py.test to locate it, and decide when to call it
    This specific method instance is used to take a screenshot whenever a test
    fails, ie whenever the method throws an exception
    """
    if call.excinfo is not None:
        if driver_register.get_driver() is not None and hasattr(item, 'obj'):
            driver_register.get_driver().get_screenshot_as_file(
                unicode(item.obj).split(u" ")[2] + u'.png')