def test_capture_shoould_vefify_screenshot_file_for_file_based_custom_screenshot(self): first_screenshot = os.path.join( os.getenv("gauge_screenshots_dir"), "screenshot{0}.png".format(uuid1())) second_screenshot = os.path.join( os.getenv("gauge_screenshots_dir"), "screenshot{0}.png".format(uuid1())) def returns_abs_path(): return first_screenshot def returns_base_ath(): return os.path.basename(second_screenshot) registry.set_screenshot_provider(returns_abs_path, True) ScreenshotsStore.capture() self.assertEqual([os.path.basename(first_screenshot)], ScreenshotsStore.pending_screenshots()) registry.set_screenshot_provider(returns_base_ath, True) ScreenshotsStore.capture() self.assertEqual([os.path.basename(second_screenshot)], ScreenshotsStore.pending_screenshots())
def custom_screenshot_writer(func): registry.set_screenshot_provider(func, True) return func
def custom_screen_grabber(func): _warn_screenshot_deprecation('custom_screen_grabber', 'custom_screenshot_writer') registry.set_screenshot_provider(func, False) return func
def screenshot(func): registry.set_screenshot_provider(func) return func
def custom_screen_grabber(func): registry.set_screenshot_provider(func) return func
def screenshot(func): _warn_screenshot_deprecation() registry.set_screenshot_provider(func) return func
def tearDown(self): registry.set_screenshot_provider( self.__old_screenshot_provider, self.__is_screenshot_writer)