Skip to content

Commit a8fac9d

Browse files
committed
Merge pull request #15 from mdmintz/nosetest-logging-defaults
Nosetest logging defaults
2 parents b96361a + 7b25ef2 commit a8fac9d

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

integrations/docker/docker_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='seleniumbase',
11-
version='1.1.25',
11+
version='1.1.26',
1212
author='Michael Mintz',
1313
author_email='@mintzworld',
1414
maintainer='Michael Mintz',

seleniumbase/plugins/base_plugin.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from nose.plugins import Plugin
1212
from nose.exc import SkipTest
1313
from seleniumbase.config import settings
14+
from seleniumbase.core import log_helper
1415
from seleniumbase.fixtures import constants, errors
1516

1617

@@ -75,6 +76,24 @@ def beforeTest(self, test):
7576
test.test.data = self.options.data
7677
test.test.args = self.options
7778

79+
def __log_all_options_if_none_specified(self, test):
80+
"""
81+
When testing_base is specified, but none of the log options to save are
82+
specified (basic_test_info, screen_shots, page_source), then save them
83+
all by default. Otherwise, save only selected ones from their plugins.
84+
"""
85+
if ((not self.options.enable_plugin_basic_test_info) and
86+
(not self.options.enable_plugin_screen_shots) and
87+
(not self.options.enable_plugin_page_source)):
88+
test_logpath = self.options.log_path + "/" + test.id()
89+
log_helper.log_screenshot(test_logpath, test.driver)
90+
log_helper.log_test_failure_data(
91+
test_logpath, test.driver, test.browser)
92+
log_helper.log_page_source(test_logpath, test.driver)
93+
94+
def addFailure(self, test, err, capt=None):
95+
self.__log_all_options_if_none_specified(test)
96+
7897
def addError(self, test, err, capt=None):
7998
"""
8099
Since Skip, Blocked, and Deprecated are all technically errors, but not
@@ -87,6 +106,8 @@ def addError(self, test, err, capt=None):
87106
print err[1].__str__().split('''-------------------- >> '''
88107
'''begin captured logging'''
89108
''' << --------------------''', 1)[0]
109+
else:
110+
self.__log_all_options_if_none_specified(test)
90111

91112
def handleError(self, test, err, capt=None):
92113
"""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name='seleniumbase',
9-
version='1.1.25',
9+
version='1.1.26',
1010
url='https://github.com/mdmintz/SeleniumBase',
1111
author='Michael Mintz',
1212
author_email='@mintzworld',

0 commit comments

Comments
 (0)