Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango unit testing - Why can't I just run ./tests.py on myApp?
    primarykey
    data
    text
    <p>So I'm very familiar with <code>manage.py test myapp</code>. But I can't figure out how to make my <code>tests.py</code> work as an stand-alone executable. You may be wondering why I would want to do this.. Well I'm working (<em>now</em>) in Eclipse and I can't seem to figure out how to set up the tool to simply run this command. Regardless it would be very nice to simply wrap <code>tests.py</code> in a simple manner to just run that.</p> <p>Here is what my <code>tests.py</code> looks like.</p> <pre><code>""" This simply tests myapp """ import sys import logging from django.test import TestCase from django.conf import settings from django.test.utils import get_runner class ModelTest(TestCase): def test_model_test1(self): """ This is test 1 """ self.failUnlessEqual(1 + 1, 2) def test_model_test2(self): """ This is test 2 """ self.failUnlessEqual(1 + 1, 2) def test_model_test3(self): """ This is test 3 """ self.failUnlessEqual(1 + 1, 2) def run_tests(): test_runner = get_runner(settings) failures = test_runner([], verbosity=9, interactive=False) sys.exit(failures) if __name__ == '__main__': # Setup Logging loglevel = logging.DEBUG logging.basicConfig(format="%(levelname)-8s %(asctime)s %(name)s %(message)s", datefmt='%m/%d/%y %H:%M:%S', stream=sys.stdout) log = logging.getLogger("") run_tests() </code></pre> <p>I think the solution is located on this line but I can't seem to figure out what the first argument needs to be in order for it to magically start working..</p> <pre><code>failures = test_runner([], verbosity=9, interactive=False) </code></pre> <p>Thanks for helping!!</p> <p>**** Updates ****</p> <p>What I am looking to do (Doh!) is to simply run "myApp" tests. The problem is that this works (and chmod is not the problem) but it wants to run the entire test suite. I don't want that. I just want to run the <code>myApp</code> test suite.</p> <p>Thanks again!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload