Skip to content

Commit 0eece58

Browse files
committed
Refactor options
1 parent 489f136 commit 0eece58

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

seleniumbase/console_scripts/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ def show_options():
813813
op += " | where / w: Show stack spot. u: Up stack. d: Down stack. |\n"
814814
op += " | longlist / ll: See code. dir(): List namespace objects. |\n"
815815
op += "--help / -h (Display list of all available pytest options.)\n"
816-
op += "--final-debug (Enter Final Debug Mode after each test ends.)\n"
816+
op += "--ftrace / --final-trace (Enter Debug Mode after any test.)\n"
817817
op += "--recorder / --rec (Save browser actions as Python scripts.)\n"
818818
op += "--rec-behave / --rec-gherkin (Save actions as Gherkin code.)\n"
819819
op += "--rec-print (Display recorded scripts when they are created.)\n"

seleniumbase/plugins/base_plugin.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
class Base(Plugin):
20-
"""This plugin adds the following command-line options to nosetests:
20+
"""This plugin adds the following command-line options to pynose:
2121
--env=ENV (Set the test env. Access with "self.env" in tests.)
2222
--account=STR (Set account. Access with "self.account" in tests.)
2323
--data=STRING (Extra test data. Access with "self.data" in tests.)
@@ -26,6 +26,7 @@ class Base(Plugin):
2626
--var3=STRING (Extra test data. Access with "self.var3" in tests.)
2727
--variables=DICT (Extra test data. Access with "self.variables".)
2828
--settings-file=FILE (Override default SeleniumBase settings.)
29+
--ftrace | --final-trace (Enter Debug Mode after any test ends.)
2930
--archive-logs (Archive old log files instead of deleting them.)
3031
--archive-downloads (Archive old downloads instead of deleting.)
3132
--report (Create a fancy nosetests report after tests complete.)
@@ -128,6 +129,19 @@ def options(self, parser, env):
128129
help="""The file that stores key/value pairs for overriding
129130
values in the SeleniumBase settings.py file.""",
130131
)
132+
parser.addoption(
133+
"--final-debug",
134+
"--final-trace",
135+
"--fdebug",
136+
"--ftrace",
137+
action="store_true",
138+
dest="final_debug",
139+
default=False,
140+
help="""Enter Debug Mode at the end of each test.
141+
To enter Debug Mode only on failures, use "--pdb".
142+
If using both "--final-debug" and "--pdb" together,
143+
then Debug Mode will activate twice on failures.""",
144+
)
131145
parser.addoption(
132146
"--log_path",
133147
"--log-path",
@@ -232,6 +246,7 @@ def beforeTest(self, test):
232246
test.test.var3 = self.options.var3
233247
test.test.variables = variables # Already verified is a dictionary
234248
test.test.settings_file = self.options.settings_file
249+
test.test._final_debug = self.options.final_debug
235250
test.test.log_path = self.options.log_path
236251
if self.options.archive_downloads:
237252
settings.ARCHIVE_EXISTING_DOWNLOADS = True

seleniumbase/plugins/pytest_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def pytest_addoption(parser):
9090
--uc | --undetected (Use undetected-chromedriver to evade bot-detection.)
9191
--uc-cdp-events (Capture CDP events when running in "--undetected" mode.)
9292
--remote-debug (Sync to Chrome Remote Debugger chrome://inspect/#devices)
93-
--final-debug (Enter Debug Mode after each test ends. Don't use with CI!)
93+
--ftrace | --final-trace (Debug Mode after each test. Don't use with CI!)
9494
--dashboard (Enable the SeleniumBase Dashboard. Saved at: dashboard.html)
9595
--dash-title=STRING (Set the title shown for the generated dashboard.)
9696
--enable-3d-apis (Enables WebGL and 3D APIs.)

seleniumbase/plugins/selenium_plugin.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class SeleniumBrowser(Plugin):
12-
"""This plugin adds the following command-line options to nosetests:
12+
"""This plugin adds the following command-line options to pynose:
1313
--browser=BROWSER (The web browser to use. Default: "chrome".)
1414
--chrome (Shortcut for "--browser=chrome". Default.)
1515
--edge (Shortcut for "--browser=edge".)
@@ -70,7 +70,6 @@ class SeleniumBrowser(Plugin):
7070
--uc | --undetected (Use undetected-chromedriver to evade bot-detection.)
7171
--uc-cdp-events (Capture CDP events when running in "--undetected" mode.)
7272
--remote-debug (Sync to Chrome Remote Debugger chrome://inspect/#devices)
73-
--final-debug (Enter Debug Mode after each test ends. Don't use with CI!)
7473
--enable-3d-apis (Enables WebGL and 3D APIs.)
7574
--swiftshader (Use Chrome's "--use-gl=swiftshader" feature.)
7675
--incognito (Enable Chrome's Incognito mode.)
@@ -757,19 +756,6 @@ def options(self, parser, env):
757756
The previous URL was at: http://localhost:9222/
758757
Info: chromedevtools.github.io/devtools-protocol/""",
759758
)
760-
parser.addoption(
761-
"--final-debug",
762-
"--final-trace",
763-
"--fdebug",
764-
"--ftrace",
765-
action="store_true",
766-
dest="final_debug",
767-
default=False,
768-
help="""Enter Debug Mode at the end of each test.
769-
To enter Debug Mode only on failures, use "--pdb".
770-
If using both "--final-debug" and "--pdb" together,
771-
then Debug Mode will activate twice on failures.""",
772-
)
773759
parser.addoption(
774760
"--enable_3d_apis",
775761
"--enable-3d-apis",
@@ -1125,7 +1111,6 @@ def beforeTest(self, test):
11251111
test.test.no_sandbox = self.options.no_sandbox
11261112
test.test.disable_gpu = self.options.disable_gpu
11271113
test.test.remote_debug = self.options.remote_debug
1128-
test.test._final_debug = self.options.final_debug
11291114
test.test.enable_3d_apis = self.options.enable_3d_apis
11301115
test.test.swiftshader = self.options.swiftshader
11311116
test.test.incognito = self.options.incognito

0 commit comments

Comments
 (0)