title: Conditional setup_requires dependencies in setup.py
body: <p>Is there any way to tell <strong>pip</strong> to skip some <em>setup_requires</em> dependencies when not needed?</p>
  
  <p>In my scenario, I have pytest-runner declared as a setup dependency (which is used to execute tests) in my setup.py. When I try to install my package (I.e: pip install my-package.tar.gz) it downloads pytest-runner or it fails it is not available (*).</p>
  
  <p>In setup.py I have:</p>
  
  <pre><code>...
  setup_requires=['pytest-runner', 'flake8']
  ...
  </code></pre>
  
  <p>I would like to tell setup.py only to use pytest-runner only when executing tests. Is that possible?</p>
  
  <p>As @deceze suggested, this declaration will work:</p>
  
  <pre><code>setup_requires=['pytest-runner', 'flake8'] if 'test' in sys.argv else []
  </code></pre>
  
  <p>But I don't want to add logic to setup.py.</p>
  
  <p>(*) The environment is very restricted, that's why downloading a dependency is a roadblock.</p>