title: pytest with workers ( -n 1 for example ) using xdist when test contains also multiprocessing
body: <p>I'm using</p>
  <ul>
  <li>Python 3.6</li>
  <li>Pytest 6.1.1</li>
  <li>Pytest xdist 2.1.0</li>
  <li>Pycharm 2018.3.7</li>
  </ul>
  <p>Using HTML plugin for report as well with customization for the report</p>
  <p>I'm running automation test via pycharm &gt;pytest with arguments as below:
  <code>--html=../../reports/report.html  --self-contained-html   -n 1   -k test_instalment_mtn_ng_unified_eco</code></p>
  <p>in order to capture the screen during selenium, i'm using multprocessing,
  that start the capturing, and continue with the test</p>
  <p>if i'm NOT using in arguments -n 1 ( means no workers) -test passed successfully ( include screen capture)</p>
  <p>if i'm using -n 1 ( means 1 worker) pytest crush with the follow error:</p>
  <pre><code>mtn_ng_tests/mtn_ng_instalment_tests/test_instalment_mtn_ng_unified_eco.py::test_instalment_mtn_ng_unified_eco[customer buy 3 months happy flow while in light-instalment_mtn_ng_unified_eco_1-3-eco-48-40-0-10-ACTIVATED-ACTIVATED-owner_phone_unified_happy_flow_mtn_ng_eco-unified_mtn_instalment_subscribe_charge_event-activation_flow_mtn_unified_instalmant_and_unsub-no-unified_mtn_instalment_unsubscribe_charge_event-sms0-false-None-false-mtn_l20_unified--free_sms0-ACTIVATION-true-Assigned to customer-Ready For Install-false--components_end_time_delta0] 
  INTERNALERROR&gt; Traceback (most recent call last):
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/_pytest/main.py&quot;, line 257, in wrap_session
  INTERNALERROR&gt;     session.exitstatus = doit(config, session) or 0
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/_pytest/main.py&quot;, line 313, in _main
  INTERNALERROR&gt;     config.hook.pytest_runtestloop(session=session)
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/pluggy/hooks.py&quot;, line 286, in __call__
  INTERNALERROR&gt;     return self._hookexec(self, self.get_hookimpls(), kwargs)
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/pluggy/manager.py&quot;, line 93, in _hookexec
  INTERNALERROR&gt;     return self._inner_hookexec(hook, methods, kwargs)
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/pluggy/manager.py&quot;, line 87, in &lt;lambda&gt;
  INTERNALERROR&gt;     firstresult=hook.spec.opts.get(&quot;firstresult&quot;) if hook.spec else False,
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/pluggy/callers.py&quot;, line 208, in _multicall
  INTERNALERROR&gt;     return outcome.get_result()
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/pluggy/callers.py&quot;, line 80, in get_result
  INTERNALERROR&gt;     raise ex[1].with_traceback(ex[2])
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/pluggy/callers.py&quot;, line 187, in _multicall
  INTERNALERROR&gt;     res = hook_impl.function(*args)
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/xdist/dsession.py&quot;, line 112, in pytest_runtestloop
  INTERNALERROR&gt;     self.loop_once()
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/xdist/dsession.py&quot;, line 135, in loop_once
  INTERNALERROR&gt;     call(**kwargs)
  INTERNALERROR&gt;   File &quot;/home/ohad/.local/lib/python2.7/e2e/lib/python3.6/site-packages/xdist/dsession.py&quot;, line 174, in worker_workerfinished
  INTERNALERROR&gt;     **assert not crashitem, (crashitem, node)**
  INTERNALERROR&gt; AssertionError: ('E2eAutomation/tests/mtn_ng_tests/mtn_ng_instalment_tests/test_instalment_mtn_ng_unified_eco.py::test_instalment_mtn_...ms0-ACTIVATION-true-Assigned to customer-Ready For Install-false--components_end_time_delta0]', &lt;WorkerController gw0&gt;)
  INTERNALERROR&gt; assert not 'E2eAutomation/tests/mtn_ng_tests/mtn_ng_instalment_tests/test_instalment_mtn_ng_unified_eco.py::test_instalment_mtn_n...e-mtn_l20_unified--free_sms0-ACTIVATION-true-Assigned to customer-Ready For Install-false--components_end_time_delta0]'
  </code></pre>
  <p>googled it for 2 days, and didnt found what could be the reason
  Attaching part of the test code
  Thanks in advance</p>
  <pre><code># @pytest.mark.skip(reason='relax for now :)')
  @pytest.mark.sanity
  @pytest.mark.regression
  @pytest.mark.instalment_mtn_ng
  @pytest.mark.parametrize(&quot;scenario_description,unit,month,unit_type,customer_deal,time_unit_purchased,&quot;
                           &quot;set_desired,light_dark,unit_set_state,unit_expected_state,&quot;
                           &quot;owner_phone,charge_event_flow,activation_flow_job_scenario,&quot;
                           &quot;real_unit,charge_event_flow_unsub,sms,ipp_flow,set_product_id,free_triggered,instalment_type,&quot;
                           &quot;free_job_flow,free_sms,unit_status_during_process,valid_product,&quot;
                           &quot;set_crm_unit_status,get_crm_unit_status,set_last_day_of_month,notes,components_end_time_delta&quot;,
                           load_data_driven_for_test(profile='instalment_mtn_ng_eco'))
  @pytest.mark.skipif(os.environ.get('DRY_RUN') == &quot;True&quot;, reason=&quot;Jenkins Dry Run&quot;)
  def test_instalment_mtn_ng_unified_eco(scenario_description, unit, month, unit_type, customer_deal, time_unit_purchased,
                                         set_desired, light_dark,
                                         unit_set_state, unit_expected_state, owner_phone, charge_event_flow,
                                         activation_flow_job_scenario, real_unit, charge_event_flow_unsub, sms, ipp_flow,
                                         set_product_id, free_triggered, instalment_type, free_job_flow, free_sms,
                                         unit_status_during_process, valid_product, set_crm_unit_status,
                                         get_crm_unit_status,
                                         set_last_day_of_month, notes, components_end_time_delta,
                                         setup, record_property):
      # ==================================================================================== Test yield from fixture
  
      lms_cursor, db_conn, lms_user, locale_sms, lms_db_connection, crm_db_connection, crm_cursor, soap_port = \
          setup[0], setup[1], setup[2], setup[3], setup[4], setup[5], setup[6], setup[7]
  
      # ====================================== Log creation ================================================
      os.environ['TEST_NUMBER'] = str(int(os.environ.get('TEST_NUMBER')) + 1)
      now = datetime.datetime.now()
      time_stamp = f&quot;{now.year}{now.month}{now.day}{now.hour}{now.minute}{now.second}&quot;
      os.environ['TEST_NAME'] = f&quot;{os.path.basename(__file__)[:-3]}_#_{os.environ.get('TEST_NUMBER')}_&quot; \
                                    f&quot;{scenario_description.replace(' ', '_')}_&quot; + time_stamp
      logging = setting_log.log_config.setup_logger()
  
      # ==================================================================================== Video recording
      if   os.environ.get('PYTEST_XDIST_WORKER_COUNT'):  # no workers so run with video capture
          video_record = multiprocessing.Process(target=ScreenVideo().execute_video_capturing)
          video_record.start()
  
          # ==================================================================================== Test Tear Down
          logging.info(&quot;test tear down&quot;)
          record_property(&quot;test_returns&quot;, {&quot;screen_recorder&quot;: video_record})
          # record_property(&quot;test_returns&quot;, {&quot;screen_recorder&quot;: video_record, &quot;selenium_driver&quot;: automation_utils})
      else:
          logging.info(&quot;test tear down&quot;)
          record_property(&quot;test_returns&quot;, {})
  
      # ========================================================Initiate logs that not created in main fixture
      assert 1==2 (just to falied the test quicker)
  </code></pre>