0
pip를 사용하여 아직 공개되지 않은 타사 Django 응용 프로그램을 설치 했으므로 이제 단위 테스트를 구현하고 있습니다. 내가 단위 테스트를 실행하려고 할 때마다 그러나, 각 테스트 케이스에 대해 다음 역 추적 결과 : 여기 타사 Django 응용 프로그램에 대한 테스트를 실행하면 "ImportError : No module named urls"가됩니다.
ERROR: test_form_page_loads (myapp.tests.tests.ViewTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/sampling/tests/tests.py", line 47, in test_form_page_loads
response = self.client.get(self.form_url)
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/test/client.py", line 453, in get
response = super(Client, self).get(path, data=data, **extra)
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/test/client.py", line 271, in get
parsed = urlparse(path)
File "/usr/lib/python2.7/urlparse.py", line 135, in urlparse
tuple = urlsplit(url, scheme, allow_fragments)
File "/usr/lib/python2.7/urlparse.py", line 168, in urlsplit
cached = _parse_cache.get(key, None)
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/utils/functional.py", line 156, in __hash__
return hash(self.__cast())
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/utils/functional.py", line 139, in __cast
return self.__bytes_cast()
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/utils/functional.py", line 135, in __bytes_cast
return bytes(func(*self.__args, **self.__kw))
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 496, in reverse
return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 382, in _reverse_with_prefix
possibilities = self.reverse_dict.getlist(lookup_view)
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 297, in reverse_dict
self._populate()
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 263, in _populate
for pattern in reversed(self.url_patterns):
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 347, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 342, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/home/yiqing/repos/dotfiles/common/virtualenvwrapper_hooks/filer_demo/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named urls
은이 응용 프로그램의 디렉토리 구조의 IT 관련의 경우 :
myapp/
├── admin.py
├── conf.py
├── forms.py
├── __init__.py
├── models.py
├── templates
├── tests
│ ├── __init__.py
│ ├── models.py
│ ├── settings.py
│ └── tests.py
├── urls.py
└── views.py