![]() ![]() Of course, having to do this for every test case (and their methods) is not the way to go (it is truly annoying), so this approach is not scalable. Give your configuration a name (optional) and click OK.Set the Script parameters to the test parameters ( test QuestionViewTests.test_index_view_with_no_questions).Set the Script to your Django project startup script ( manage.py).By default, this will also add the path in the Python's modules search paths Set the Working directory to the root path of your project (for me it is " E:\Work\Dev\Django\Tutorials\proj0\src").Add a new configuration having the type: Python.On the Run/Debug Configurations dialog:.Click on the menu Run -> Edit Configurations.Īlthough this is not an answer to the question (it's only remotely related), I'm posting it anyway (I'm sure that many people already did it): As an example, I'm going to attempt running polls/tests.py: QuestionViewTests.test_index_view_with_no_questions()Īs a note, setting DJANGO_SETTINGS_MODULE as the exception instructs, triggers another one, and so on. ![]() I will incorporate any possible comment that adds value into the solution.īack to the question: I did my tests / research on a project that consists of Django Tutorial ( : Writing your first Django app) some parts from Django Rest Framework Tutorial ( : Quickstart). Regarding P圜harm, I worked with it for some years, but only as an IDE (like P圜harm for dummies), so I didn't get into its advanced stuffĬonsidering the above, some (or all) parts of the solution might seem cumbersome / stupid for some advanced users, so please bear with me.I am only working with Django for ~3 months.Note: I only added the question to provide an answer that might be useful to someone. You must either define the environment variable DJANGO_SETTINGS_MODULE or call nfigure() before accessing settings. Self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACEįile "E:\Work\Dev\VEnvs\py2713圆4-django\lib\site-packages\django\conf\_init_.py", line 53, in _getattr_įile "E:\Work\Dev\VEnvs\py2713圆4-django\lib\site-packages\django\conf\_init_.py", line 39, in _setupĭ圜onfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. Super(CharField, self)._init_(*args, **kwargs)įile "E:\Work\Dev\VEnvs\py2713圆4-django\lib\site-packages\django\db\models\fields\_init_.py", line 166, in _init_ Question_text = models.CharField(max_length=200)įile "E:\Work\Dev\VEnvs\py2713圆4-django\lib\site-packages\django\db\models\fields\_init_.py", line 1043, in _init_ Module = imp.load_source(moduleName, fileName)įile "E:\Work\Dev\Django\Tutorials\proj0\src\polls\tests.py", line 7, in įile "E:\Work\Dev\Django\Tutorials\proj0\src\polls\models.py", line 9, in įile "E:\Work\Dev\Django\Tutorials\proj0\src\polls\models.py", line 10, in Question Unfortunately, that yields an exception: Traceback (most recent call last):įile "C:\Install\P圜harm Community Edition\2016.3.2\helpers\pycharm\utrunner.py", line 254, in įile "C:\Install\P圜harm Community Edition\2016.3.2\helpers\pycharm\utrunner.py", line 232, in mainįile "C:\Install\P圜harm Community Edition\2016.3.2\helpers\pycharm\utrunner.py", line 65, in loadSource The question is simple: in P圜harm, one can Run (Debug) an Unit Test ( TestCase or one of its methods) with a simple mouse right click (from the context menu) just as in the image below: I've Googled my problem and (surprisingly,) I did not get any answers, (of course I don't exclude the possibility that there might be some, be but I just missed them). I must emphasize on P圜harm Community Edition which does not have any Django integration ( v 2016.3.2 at question time).
0 Comments
Leave a Reply. |