how to include tests in a distributable django app?
<p>I distribute a small django app that I wanted to write a test for. It uses some settings and I was importing </p>

<p><code>from django.conf import settings</code> </p>

<p>in the app file but this leaves me with a problem because the standalone app has no django project so how would one write and run tests on it?</p>

<p>In your app folder, create a folder named <code>tests</code>, and in that folder place your tests (in a single <code>.py</code> file or multiple files. </p>

<p>You will end up with a folder structure like this:</p>

<pre><code>my_app/
    tests/
        test_views.py
        test_other_stuff.py
</code></pre>

<p>Then you will be able to run your test suite for that app using:</p>

<pre><code>`./manage.py test my_app`
</code></pre>

<p>Where <code>my_app</code> is the name of your app. As far as how to write the tests themselves, <a href="https://docs.djangoproject.com/en/1.10/topics/testing/overview/" rel="nofollow">the Django docs</a> are very helpful.</p>

python django