Opened 8 months ago

Last modified 3 months ago

#28034 assigned Cleanup/optimization

Update the contributing tutorial to use a more recent patch

Reported by: Mateusz Jankowski Owned by: Joe Krzystan
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have started going through https://docs.djangoproject.com/en/dev/intro/contributing/. As advised in https://docs.djangoproject.com/en/dev/intro/contributing/#rolling-back-to-a-previous-revision-of-django I go back to commit 4ccfc4439a7add24f8db4ef3960d02ef8ae09887 (from 26 May 2015). I run the tests and some are failing. I ignore this as of "If you’re using Python 3.5+, there will be a couple failures related to deprecation warnings that you can ignore. These failures have since been fixed in Django." in https://docs.djangoproject.com/en/dev/intro/contributing/#running-django-s-test-suite-for-the-first-time. But I also get one error in servers.test_basehttp.WSGIRequestHandlerTestCase.test_strips_underscore_headers.

I'm running Python 3.6.1 on MacOS Sierra 10.12.2.

Traceback:

(djangodev) django/tests [4ccfc44] » ./runtests.py servers.test_basehttp.WSGIRequestHandlerTestCase.test_strips_underscore_headers
Testing against Django installed in '/Users/mateuszjankowski/Code/django/django'
Creating test database for alias 'default'...
Creating test database for alias 'other'...
E
======================================================================
ERROR: test_strips_underscore_headers (servers.test_basehttp.WSGIRequestHandlerTestCase)
WSGIRequestHandler ignores headers containing underscores.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 332, in send_headers
    self.send_preamble()
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 252, in send_preamble
    self._write(('HTTP/%s %s\r\n' % (self.http_version,self.status)).encode('iso-8859-1'))
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 775, in write
    self._sock.sendall(b)
AttributeError: 'Stub' object has no attribute 'sendall'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 141, in run
    self.handle_error()
  File "/Users/mateuszjankowski/Code/django/django/core/servers/basehttp.py", line 92, in handle_error
    super(ServerHandler, self).handle_error()
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 368, in handle_error
    self.finish_response()
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 344, in client_is_modern
    return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mateuszjankowski/Code/django/tests/servers/test_basehttp.py", line 72, in test_strips_underscore_headers
    WSGIRequestHandler(request, '192.168.0.2', server)
  File "/Users/mateuszjankowski/Code/django/django/core/servers/basehttp.py", line 99, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/Users/mateuszjankowski/Code/django/django/core/servers/basehttp.py", line 179, in handle
    handler.run(self.server.get_app())
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/handlers.py", line 144, in run
    self.close()
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/wsgiref/simple_server.py", line 35, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

----------------------------------------------------------------------
Ran 1 test in 0.002s

FAILED (errors=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...

Change History (6)

comment:1 Changed 8 months ago by Matteo Parrucci

The specific test you mention did not fail for me but I have something more than "a couple" tests failing:

FAILED (failures=37, errors=946, skipped=574, expected failures=6)

But may be it's ok after all

Using python 3.5.2 on Linux mint 18

comment:2 Changed 8 months ago by Tim Graham

Summary: Error when running tests in "Writing your first patch for Django" tutorial.Update the contributing tutorial to use a more recent patch
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

That point in Django's history doesn't have the Python 3.6 compatibility fixes. We should update the tutorial to use a more recent commit (this was last done in 3fd754f12df42d173b6e9a93e7c32f8f5be55e7f). 0034e9af18f3d393a6dd2389ffbba4c919b1d7d7 could be a candidate patch to use for the tutorial.

comment:3 Changed 4 months ago by Joe Krzystan

Owner: changed from nobody to Joe Krzystan
Status: newassigned

comment:4 Changed 4 months ago by Joe Krzystan

Has patch: set

comment:5 Changed 4 months ago by Tim Graham

At this point, it would be idea to use a more recent patch that doesn't require an old version of Sphinx to build the documentation. I'm beginning to wonder if there might be a better approach to this tutorial so that we don't have to update it every so often.

comment:6 Changed 3 months ago by Tim Graham

Has patch: unset

I merged 407c1249c9a0296ec8a8d95e447bd695ca471b5e today. That could be a candidate to use.

Note: See TracTickets for help on using tickets.
Back to Top