Skip to content

Nosetest logging defaults #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integrations/docker/docker_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='seleniumbase',
version='1.1.25',
version='1.1.26',
author='Michael Mintz',
author_email='@mintzworld',
maintainer='Michael Mintz',
Expand Down
21 changes: 21 additions & 0 deletions seleniumbase/plugins/base_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from nose.plugins import Plugin
from nose.exc import SkipTest
from seleniumbase.config import settings
from seleniumbase.core import log_helper
from seleniumbase.fixtures import constants, errors


Expand Down Expand Up @@ -75,6 +76,24 @@ def beforeTest(self, test):
test.test.data = self.options.data
test.test.args = self.options

def __log_all_options_if_none_specified(self, test):
"""
When testing_base is specified, but none of the log options to save are
specified (basic_test_info, screen_shots, page_source), then save them
all by default. Otherwise, save only selected ones from their plugins.
"""
if ((not self.options.enable_plugin_basic_test_info) and
(not self.options.enable_plugin_screen_shots) and
(not self.options.enable_plugin_page_source)):
test_logpath = self.options.log_path + "/" + test.id()
log_helper.log_screenshot(test_logpath, test.driver)
log_helper.log_test_failure_data(
test_logpath, test.driver, test.browser)
log_helper.log_page_source(test_logpath, test.driver)

def addFailure(self, test, err, capt=None):
self.__log_all_options_if_none_specified(test)

def addError(self, test, err, capt=None):
"""
Since Skip, Blocked, and Deprecated are all technically errors, but not
Expand All @@ -87,6 +106,8 @@ def addError(self, test, err, capt=None):
print err[1].__str__().split('''-------------------- >> '''
'''begin captured logging'''
''' << --------------------''', 1)[0]
else:
self.__log_all_options_if_none_specified(test)

def handleError(self, test, err, capt=None):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='seleniumbase',
version='1.1.25',
version='1.1.26',
url='https://github.com/mdmintz/SeleniumBase',
author='Michael Mintz',
author_email='@mintzworld',
Expand Down