Skip to content

Commit 5009e92

Browse files
author
Dzmitry Humianiuk
authored
Merge pull request #75 from aliaksandr-trush/feature/enable
enable implicit plugin usage
2 parents 8deca4d + 2555029 commit 5009e92

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ If you don't want to attach specific markers, list them in :code:`rp_ignore_tags
144144
Launching
145145
~~~~~~~~~
146146

147-
To run test with Report Portal you can specify name of :code:`launch`:
147+
To run test with Report Portal you must provide '--reportportal' flag:
148148

149149
.. code-block:: bash
150150
151-
py.test ./tests --rp-launch AnyLaunchName
151+
py.test ./tests --reportportal
152152
153153
154154
Troubleshooting

pytest_reportportal/plugin.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def pytest_sessionstart(session):
4343
# Stop now if the plugin is not properly configured
4444
return
4545

46+
if not session.config.option.enabled:
47+
return
48+
4649
if is_master(session.config):
4750
session.config.py_test_service.init_service(
4851
project=session.config.getini('rp_project'),
@@ -108,6 +111,9 @@ def pytest_sessionfinish(session):
108111
# Stop now if the plugin is not properly configured
109112
return
110113

114+
if not session.config.option.enabled:
115+
return
116+
111117
# FixMe: currently method of RP api takes the string parameter
112118
# so it is hardcoded
113119
if is_master(session.config):
@@ -177,6 +183,14 @@ def pytest_addoption(parser):
177183
dest='rp_launch_description',
178184
help='Launch description (overrides rp_launch_description config option)')
179185

186+
group.addoption(
187+
'--reportportal',
188+
action='store_true',
189+
dest='enabled',
190+
default=False,
191+
help='Enable ReportPortal plugin'
192+
)
193+
180194
if PYTEST_HAS_LOGGING_PLUGIN:
181195
group.addoption(
182196
'--rp-log-level',

0 commit comments

Comments
 (0)