pytest: how to make dedicated test directory
<p>I want the following project structure:  </p>

<pre><code>|--folder/
|  |--tests/
|  |--project/
</code></pre>

<p>Let's write a simple example:</p>

<pre><code>|--test_pytest/
|  |--tests/
|  |  |--test_sum.py
|  |--t_pytest/
|  |  |--sum.py
|  |  |--__init__.py
</code></pre>

<p>sum.py:  </p>

<pre><code>def my_sum(a, b):
    return a + b
</code></pre>

<p>test_sum.py:  </p>

<pre><code>from t_pytest.sum import my_sum
def test_my_sum():
    assert my_sum(2, 2) == 5, "math still works"
</code></pre>

<p>Let's run it:</p>

<pre><code>test_pytest$ py.test ./
========== test session starts ===========
platform linux -- Python 3.4.3, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /home/step/test_pytest, inifile: 
collected 0 items / 1 errors 

================= ERRORS =================
___ ERROR collecting tests/test_sum.py ___
tests/test_sum.py:1: in &lt;module&gt;
    from t_pytest import my_sum
E   ImportError: No module named 't_pytest'
======== 1 error in 0.01 seconds =========
</code></pre>

<p>It can't see t_pytest module. It was made like httpie:</p>

<p><a href="https://github.com/jkbrzt/httpie/" rel="noreferrer">https://github.com/jkbrzt/httpie/</a></p>

<p><a href="https://github.com/jkbrzt/httpie/blob/master/tests/test_errors.py" rel="noreferrer">https://github.com/jkbrzt/httpie/blob/master/tests/test_errors.py</a></p>

<p>Why? How can I correct it?</p>