Unit testing in Django / Tastypie -
i trying run few tests tastypie app following error.
finding files... done. importing test modules ... traceback (most recent call last): file "c:\users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\pydev_runfiles.py", line 468, in __get_module_from_str mod = __import__(modname) file "djangotastypie/myapp\tests.py", line 2, in <module> tastypie.test import resourcetestcasemixin file "c:\python27\lib\site-packages\tastypie\test.py", line 9, in <module> tastypie.serializers import serializer file "c:\python27\lib\site-packages\tastypie\serializers.py", line 12, in <module> tastypie.exceptions import badrequest, unsupportedformat file "c:\python27\lib\site-packages\tastypie\exceptions.py", line 83, in <module> class immediatehttpresponse(tastypieerror): file "c:\python27\lib\site-packages\tastypie\exceptions.py", line 94, in immediatehttpresponse _response = httpresponse("nothing provided.") file "c:\python27\lib\site-packages\django\http\response.py", line 340, in __init__ super(httpresponse, self).__init__(*args, **kwargs) file "c:\python27\lib\site-packages\django\http\response.py", line 125, in __init__ content_type = '%s; charset=%s' % (settings.default_content_type, file "c:\python27\lib\site-packages\django\conf\__init__.py", line 48, in __getattr__ self._setup(name) file "c:\python27\lib\site-packages\django\conf\__init__.py", line 44, in _setup self._wrapped = settings(settings_module) file "c:\python27\lib\site-packages\django\conf\__init__.py", line 92, in __init__ mod = importlib.import_module(self.settings_module) file "c:\python27\lib\importlib\__init__.py", line 37, in import_module __import__(name) importerror: no module named djangotastypie.settings error: module: tests not imported (file: djangotastypie\myapp\tests.py). done. traceback (most recent call last): file "c:\users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\runfiles.py", line 234, in <module> main() file "c:\users\use\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\runfiles.py", line 78, in main return pydev_runfiles.main(configuration) # note: still doesn't return proper value. file "c:\users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\pydev_runfiles.py", line 835, in main pydevtestrunner(configuration).run_tests() file "c:\users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\pydev_runfiles.py", line 793, in run_tests mydjangotestsuiterunner(run_tests).run_tests([]) file "c:\users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\pydev_runfiles.py", line 813, in run_tests raise assertionerror("unable run suite djangotestsuiterunner because couldn't imported.") assertionerror: unable run suite djangotestsuiterunner because couldn't imported. do need add somthing installed_apps section of settings.py ? or tests need located elsewhere ? right using basic structure when start new django project , test on tests.py
ok found out issue eclipse -> run pyunit option. when run using manage.py test error
====================================================================== error: myapp.tests (unittest.loader.moduleimportfailure) ---------------------------------------------------------------------- importerror: failed import test module: myapp.tests traceback (most recent call last): file "c:\python27\lib\unittest\loader.py", line 254, in _find_tests module = self._get_module_from_name(name) file "c:\python27\lib\unittest\loader.py", line 232, in _get_module_from_name __import__(name) file "c:\users\dhanushka.amarakoon\git\lcapi\djangotastypie\myapp\tests.py", line 2, in <module> tastypie.test import resourcetestcasemixin importerror: cannot import name resourcetestcasemixin
ok figured out did wrong. first using eclipse->run , pyunit using older code. , got import error coz used wrong class name resourcetestcasemixin instead of resourcetestcase
Comments
Post a Comment