# Path: viceroy/exceptions.py
# class ResultNotFound(ViceroyException):
#     pass
# 
# Path: viceroy/exceptions.py
# class JavascriptError(ViceroyException):
#     pass


import contextlib
import os
import unittest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from .exceptions import ResultNotFound
from .exceptions import JavascriptError
                )
                WebDriverWait(
                    driver,
                    cls.viceroy_timeout
                ).until(
                    lambda _: driver.execute_script(
                        'return window.VICEROY && window.VICEROY.DONE;'
                    )
                )
                return driver.execute_script('return window.VICEROY.RESULTS;')

    @classmethod
    def setUpClass(cls):
        super(ViceroyTestCase, cls).setUpClass()
        cls.viceroy_cache = cls.viceroy_get_results()

    @classmethod
    def tearDownClass(cls):
        if hasattr(cls, 'viceroy_cache'):
            del cls.viceroy_cache
        super(ViceroyTestCase, cls).tearDownClass()


def test_method_proxy(full_name, short_name):
    def test_method(self):
        result = self.viceroy_cache.get(short_name, None)
        if result is None:
            result = self.viceroy_cache.get('viceroy_javascript_error', None)
            if result is None:
                keys = self.viceroy_cache.keys()

# Path: viceroy/exceptions.py
# class ResultNotFound(ViceroyException):
#     pass
# 
# Path: viceroy/exceptions.py
# class JavascriptError(ViceroyException):
#     pass


# Path: viceroy/api.py
import contextlib
import os
import unittest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from .exceptions import ResultNotFound
from .exceptions import JavascriptError

                )
                WebDriverWait(
                    driver,
                    cls.viceroy_timeout
                ).until(
                    lambda _: driver.execute_script(
                        'return window.VICEROY && window.VICEROY.DONE;'
                    )
                )
                return driver.execute_script('return window.VICEROY.RESULTS;')

    @classmethod
    def setUpClass(cls):
        super(ViceroyTestCase, cls).setUpClass()
        cls.viceroy_cache = cls.viceroy_get_results()

    @classmethod
    def tearDownClass(cls):
        if hasattr(cls, 'viceroy_cache'):
            del cls.viceroy_cache
        super(ViceroyTestCase, cls).tearDownClass()


def test_method_proxy(full_name, short_name):
    def test_method(self):
        result = self.viceroy_cache.get(short_name, None)
        if result is None:
            result = self.viceroy_cache.get('viceroy_javascript_error', None)
            if result is None:
                keys = self.viceroy_cache.keys()

                raise ResultNotFound(