dlamotte / django-tagging

Automatically exported from code.google.com/p/django-tagging
Other
0 stars 0 forks source link

Unable to run tests.py due to "DJANGO_SETTINGS_MODULE is undefined." #175

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
As subject.  I wanted to run tests.py.  No instructions, and 
===
$ python
Python 2.4.4 (#2, Apr 15 2008, 23:43:20) 
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import doctest
>>> import tests
>>> doctest(tests)
===
produces hundreds of errors, including
===
ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.
===

Pity, because the tests looked to be quite nice.

-- 
Jonathan

Original issue reported on code.google.com by Jonathan.Fine1@googlemail.com on 25 Nov 2008 at 10:14

GoogleCodeExporter commented 8 years ago
importing from the django shell rather than the python shell should fix this

Original comment by catojohn...@gmail.com on 18 Dec 2008 at 7:22

GoogleCodeExporter commented 8 years ago
This isn't how you run the tests. Make sure you are running in an environment 
that sets 
DJANGO_SETTINGS_MODULE correctly.

Original comment by bros...@gmail.com on 23 Aug 2009 at 5:01

GoogleCodeExporter commented 8 years ago
Thank you, brosner.  I suggest then that a tool that sets up such an 
environment be
supplied, or that a README file containing helpful information on this be 
provided.

Original comment by Jonathan.Fine1@googlemail.com on 23 Aug 2009 at 7:54

GoogleCodeExporter commented 8 years ago
There is a tool. It comes with Django too ;-)

django-admin.py test --settings=tagging.tests.settings

Original comment by bros...@gmail.com on 23 Aug 2009 at 7:11

GoogleCodeExporter commented 8 years ago
Thank you very much for this.  I'll know much better next time (I hope).

I agree that 'invalid' is a satisfactory closure for this issue.

Original comment by Jonathan.Fine1@googlemail.com on 23 Aug 2009 at 7:30