[Django] #22544: Error happened when I use LiveServerTestCase to test static file

11 views
Skip to first unread message

Django

unread,
Apr 30, 2014, 2:21:55 AM4/30/14
to django-...@googlegroups.com
#22544: Error happened when I use LiveServerTestCase to test static file
-----------------------------------+------------------------
Reporter: lifeng | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7-beta-2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+------------------------
I know I should use StaticLiveServerCase to test static file, and when I
use it, everything is OK. But when I use LiveServerTestCase to test static
file, some error occurred. Bellow is the error message:


{{{

TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
.Traceback (most recent call last):
File "/usr/lib/python3.3/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-
packages/django/test/testcases.py", line 1011, in __call__
return super(FSFilesHandler, self).__call__(environ, start_response)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-
packages/django/core/handlers/wsgi.py", line 187, in __call__
response = self.get_response(request)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-
packages/django/test/testcases.py", line 994, in get_response
return self.serve(request)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-
packages/django/test/testcases.py", line 1006, in serve
return serve(request, final_rel_path,
document_root=self.get_base_dir())
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-
packages/django/views/static.py", line 50, in serve
fullpath = os.path.join(document_root, newpath)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/posixpath.py", line
83, in join
path += b

}}}

The document_root is None, Is there anything wrong in
[https://github.com/django/django/blob/stable/1.7.x/django/test/testcases.py#L993]

--
Ticket URL: <https://code.djangoproject.com/ticket/22544>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 30, 2014, 2:29:40 AM4/30/14
to django-...@googlegroups.com
#22544: Error happened when I use LiveServerTestCase to test static file
-----------------------------------+--------------------------------------

Reporter: lifeng | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7-beta-2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by lifeng):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Sorry, I forgot my environment, it's python3.3, django1.7.2.

--
Ticket URL: <https://code.djangoproject.com/ticket/22544#comment:1>

Django

unread,
Apr 30, 2014, 7:19:41 AM4/30/14
to django-...@googlegroups.com
#22544: Error happened when I use LiveServerTestCase to test static file
-----------------------------------+--------------------------------------
Reporter: lifeng | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.7-beta-2
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by timo):

* status: new => closed
* resolution: => invalid


Comment:

It looks like you need to set `settings.STATIC_ROOT` to avoid that
exception.

--
Ticket URL: <https://code.djangoproject.com/ticket/22544#comment:2>

Reply all
Reply to author
Forward
0 new messages