title: How to run tests without installing package?
body: <p>I have some Python package and some tests. The files are layed out following <a href="http://pytest.org/latest/goodpractices.html#choosing-a-test-layout-import-rules" rel="noreferrer">http://pytest.org/latest/goodpractices.html#choosing-a-test-layout-import-rules</a></p>
  
  <blockquote>
    <p>Putting tests into an extra directory outside your actual application
    code, useful if you have many functional tests or for other reasons
    want to keep tests separate from actual application code (often a good
    idea):</p>
  
  <pre><code>setup.py   # your distutils/setuptools Python package metadata
  mypkg/
      __init__.py
      appmodule.py
  tests/
          test_app.py
  </code></pre>
  </blockquote>
  
  <p>My problem is, when I run the tests <code>py.test</code>, I get an error</p>
  
  <blockquote>
    <p>ImportError: No module named 'mypkg'</p>
  </blockquote>
  
  <p>I can solve this by installing the package <code>python setup.py install</code> but this means the tests run against the <em>installed</em> package, not the local one, which makes development very tedious. Whenever I make a change and want to run the tests, I need to reinstall, else I am testing the old code. </p>
  
  <p>What can I do?</p>