@@ -29,13 +29,20 @@ def is_master(config):
2929
3030@pytest .mark .optionalhook
3131def pytest_configure_node (node ):
32+ if node .config ._reportportal_enabled is False :
33+ # Stop now if the plugin is not properly configured
34+ return
3235 node .slaveinput ['py_test_service' ] = pickle .dumps (node .config .py_test_service )
3336
3437
3538def pytest_sessionstart (session ):
3639 if session .config .getoption ('--collect-only' , default = False ) is True :
3740 return
3841
42+ if session .config ._reportportal_configured is False :
43+ # Stop now if the plugin is not properly configured
44+ return
45+
3946 if is_master (session .config ):
4047 session .config .py_test_service .init_service (
4148 project = session .config .getini ('rp_project' ),
@@ -67,13 +74,24 @@ def pytest_sessionfinish(session):
6774 if session .config .getoption ('--collect-only' , default = False ) is True :
6875 return
6976
77+ if session .config ._reportportal_configured is False :
78+ # Stop now if the plugin is not properly configured
79+ return
80+
7081 # FixMe: currently method of RP api takes the string parameter
7182 # so it is hardcoded
7283 if is_master (session .config ):
7384 session .config .py_test_service .finish_launch (status = 'RP_Launch' )
7485
7586
7687def pytest_configure (config ):
88+ project = config .getini ('rp_project' )
89+ endpoint = config .getini ('rp_endpoint' )
90+ uuid = config .getini ('rp_uuid' )
91+ config ._reportportal_configured = all ([project , endpoint , uuid ])
92+ if config ._reportportal_configured is False :
93+ return
94+
7795 if not config .option .rp_launch :
7896 config .option .rp_launch = config .getini ('rp_launch' )
7997 if not config .option .rp_launch_description :
@@ -105,6 +123,10 @@ def pytest_configure(config):
105123
106124
107125def pytest_unconfigure (config ):
126+ if config ._reportportal_configured is False :
127+ # Stop now if the plugin is not properly configured
128+ return
129+
108130 config .py_test_service .terminate_service ()
109131
110132 if hasattr (config , '_reporter' ):
0 commit comments