title: PyTest: skip entire module/file (python 2 and 3)
body: <p>I want to skip an entire test if imports don't work:</p>
  
  <pre><code>try:
    import networkx
  except:
    import pytest
    pytest.skip()
  </code></pre>
  
  <p>This works fine with python-2.7 and python-3.5, both using pytest-2.8.1. When I try to run the code in python-3.6 with pytest-3.0.5 I get the following error:</p>
  
  <blockquote>
    <p>Using pytest.skip outside of a test is not allowed. If you are trying to decorate a test function, use the @pytest.mark.skip or @pytest.mark.skipif decorators instead.</p>
  </blockquote>
  
  <p>How can I write code/tests that works on all mentioned environments? I already tried to rewrite the except block like this but then it only works for the newest configuration:</p>
  
  <pre><code>try:
    pytest.skip()
  except:
    pytestmark = pytest.mark.skip
  </code></pre>