title: How to test setup.py?
body: <p>I have been collecting unit test coverage from my library but, since I have no test case for <code>setup.py</code>, this file always gives 0. </p>
  
  <p>Does anyone ever test <code>setup.py</code> using <code>nosetests</code>? Here is my file structure:</p>
  
  <pre><code>setup.py
  library/*.py
  tests/test*.py
  doc/source/*.rst
  </code></pre>
  
  <p>Here's my test command. I ran it in the same directory where setup.py locates:</p>
  
  <pre><code>nosetests --with-cov --with-doctest --doctest-extension=.rst
  </code></pre>
  
  <p>The coverage output is like this:</p>
  
  <pre><code>----------- coverage: platform win32, python 2.7.5-final-0 -----------
  Name                                  Stmts   Miss  Cover
  ---------------------------------------------------------
  library\__init__                         18      0   100%
  setup                                    10     10     0%
  ....
  tests\xxxxxxx                            8      2    75%
  ---------------------------------------------------------
  TOTAL                                   253     39    85%
  ----------------------------------------------------------------------
  </code></pre>
  
  <p>Because setup.py contributed 0 to my coverage, I would never reach 100% coverage.</p>