title: PytestWarning: Module already imported so cannot be rewritten: pytest_remotedata
body: <p>I created some unit tests and run them from the same file.  For tests in the same file:</p>
  
  <pre><code>if __name__ == "__main__":
      import pytest
      pytest.main(['--tb=short', __file__])
  </code></pre>
  
  <p>For tests in another file:</p>
  
  <pre><code>if __name__ == '__main__':
      import pytest
      pytest.main(['./test_stuff.py', "--capture=sys"])
  </code></pre>
  
  <p>In either case, when I execute the file the first time, it works fine, but the second and subsequent times it gives a bunch of warnings:</p>
  
  <pre><code>============================== warnings summary ===============================
  C:\Anaconda3\lib\site-packages\_pytest\config\__init__.py:754
    C:\Anaconda3\lib\site-packages\_pytest\config\__init__.py:754: PytestWarning: Module already imported so cannot be rewritten: pytest_remotedata
      self._mark_plugins_for_rewrite(hook)
    C:\Anaconda3\lib\site-packages\_pytest\config\__init__.py:754: PytestWarning: Module already imported so cannot be rewritten: pytest_openfiles
      self._mark_plugins_for_rewrite(hook)
    C:\Anaconda3\lib\site-packages\_pytest\config\__init__.py:754: PytestWarning: Module already imported so cannot be rewritten: pytest_doctestplus
      self._mark_plugins_for_rewrite(hook)
    C:\Anaconda3\lib\site-packages\_pytest\config\__init__.py:754: PytestWarning: Module already imported so cannot be rewritten: pytest_arraydiff
      self._mark_plugins_for_rewrite(hook)
  
  -- Docs: https://docs.pytest.org/en/latest/warnings.html
  ==================== 1 passed, 4 warnings in 0.06 seconds 
  </code></pre>
  
  <p>Is there any way to make these warnings go away?</p>
  
  <p>Restarting the kernel works, but IPython's <code>%reset</code> and <code>%clear</code> aren't enough to fix it, either.</p>