Resolve test_file_wrapper_no_sendfile found in (regressiontests.builtin_server.tests.WSGIFileWrapperTests)

Create issue
Issue #36 resolved
g8tam created an issue

Python 2.x successfully passes this test while Python 3.1 fails it. The "stdout.getvalue()" returns null and we should research what causes this error and implement a lib2to3 fixer if applicable.

====================================================================== ERROR: test_file_wrapper_no_sendfile (regressiontests.builtin_server.tests.WSGIFileWrapperTests)


Traceback (most recent call last): File "/home/neo/Desktop/django-3k/build/tests/regressiontests/builtin_server/tests.py", line 51, in test_file_wrapper_no_sendfile self.assertEqual(handler.stdout.getvalue().splitlines()[-1],'Hello World!') IndexError: list index out of range


Ran 2 tests in 0.001s

FAILED (errors=1)

Comments (1)

  1. g8tam reporter

    Research has been finished. The cause of the error are a few lines in Django.core.servers.BaseHTTP. Adding or removing a b() to ServerHandler.write() fixes errors due to Py3's conversion from str to bytes. The str to bytes conversion messes up io.StringIO. The builtin_server works perfectly when the above changes are added to Django.core.servers.BaseHTTP.

    Future implementation: decide on making a lib2to3 fixer that correctly adds/removes the b()'s OR a function in setup.py that applies a patch to this file.

  2. Log in to comment