Commit Graph

36 Commits

Author SHA1 Message Date
Adam Johnson
ca61162129
Lint with pre-commit (#365)
* Lint with pre-commit

* Move existing tox qa hooks into pre-commit.
* Set up GitHub Action based on https://github.com/pre-commit/action/ (we could also use https://pre-commit.ci ).
* Add `pyupgrade` to drop old Python syntax.
* Add `flake8-bugbear` plugin to prevent flake8 errors.

* Drop custom GHA
2021-04-07 20:11:21 +02:00
Carlton Gibson
a69723ca3f Version 3.0 release.
* Bump version number.
* Changelog.
* README.
* Update asgiref dependency specifier to match Django 3.1.
2020-10-28 20:52:00 +01:00
Samori Gorse
e1b77e930b
Added request body chunking (#335)
The entire body was previously read in memory which would lead
the server to be killed by the scheduler.
This change allows 8Kb chunks to be read until the entire body is
consummed.

Co-authored-by: Samori Gorse <samori@codeinstyle.io>
2020-10-21 16:38:03 +02:00
Carlton Gibson
eb582d1d43 Releasing 2.4.0 2019-11-20 20:41:07 +01:00
Carlton Gibson
d3630e0925
Pin hypothesis at 4.2.3 (#283)
https://travis-ci.org/django/daphne/jobs/595912612

Requirement already satisfied: attrs>=17.4.0 in /home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages (from twisted) (18.2.0)

hypothesis 4.40.0 has requirement attrs>=19.2.0, but you'll have attrs 18.2.0 which is incompatible.
2019-10-10 05:05:08 +02:00
Mario Rodas
f46c2448b1 Added compatibility for hypothesis 4 (#261)
hypothesis `average_size` argument was already deprecated [1], and was
effectively removed in hypothesis 4 [2].

[1] https://github.com/HypothesisWorks/hypothesis/pull/1162
[2] https://hypothesis.readthedocs.io/en/latest/changes.html#v4-0-0
2019-06-17 10:10:14 +02:00
Alan Rominger
a3494215cf Require installing Twisted TLS extras. (#257) 2019-04-13 15:04:56 +02:00
Tom Christie
f52960e587 Support ASGI3 (#255) 2019-04-09 11:36:18 +02:00
Andrew Godwin
67cfa98b00 Fixing test dependencies to actual versions 2019-01-31 17:43:23 -08:00
Andrew Godwin
0ed6294406 Implement Black code formatting 2018-08-27 12:29:57 +10:00
Andrew Godwin
e16b58bcb5 Releasing 2.2.1 2018-07-22 09:47:14 -07:00
Andrew Godwin
4eb6cab9aa Fix #180: asgiref is not a required dependency 2018-02-24 10:45:04 -08:00
Andrew Godwin
f18078e53d Remove Python 2.7 classifiers 2018-02-01 23:20:39 -08:00
Andrew Godwin
26fa870540 Move to "body" everywhere in HTTP messages 2017-11-29 21:27:24 -08:00
Andrew Godwin
b55fc382e8 Tox is no longer needed for tests. 2017-11-28 23:49:51 -08:00
Andrew Godwin
b3115e8dcf Start fixing travis config 2017-11-25 18:35:12 -08:00
Andrew Godwin
0626f39214 Unify all strings to double quotes 2017-11-25 13:41:38 -08:00
Andrew Godwin
22aa56e196 Start on fixing tests 2017-11-25 13:39:46 -08:00
Andrew Godwin
01f174bf26 Trying out asyncio based interface 2017-09-07 21:24:14 -07:00
Yoan Blanc
382318b6d2 Run tox tests from travis. (#104) 2017-04-03 15:49:08 +02:00
Andrew Godwin
46656aad24 Releasing version 1.2.0
Includes some test fixes for the new reply channel style.
2017-04-01 15:26:57 +01:00
Andrew Godwin
2edfe5d7d5 Ah yes, Twisted 17 releases start at 17.1 2017-03-18 12:32:04 -07:00
Andrew Godwin
a925ce32cd Add in HTTP/2 support with right deps and log info 2017-03-18 12:10:20 -07:00
Maik Hoepfel
7f92a48293 Full test suite for HTTP requests (#91)
* Add Hypothesis for property-based tests

Hypothesis:
"It works by letting you write tests that assert that
something should be true for every case, not just the ones you happen to
think of."

I think it's well suited for the task of ensuring Daphne conforms to the
ASGI specification.

* Fix accidental cast to byte string under Python 2

While grepping for calls to str(), I found this bit which looks like a
cast to unicode was intended under Python 2.

* ASGITestCase - checking channel messages for spec conformance

This commit introduces a new test case class, with it's main method
assert_valid_http_request_message. The idea is
that this method is a translation of the ASGI spec to code, and can be
used to check channel messages for conformance with that part of the
spec.

I plan to add further methods for other parts of the spec.

* Add Hypothesis strategies for generating HTTP requests

Hypothesis, our framework for test data generation, contains only
general so-called strategies for generating data. This commit adds a few
which will be useful for generating the data for our tests.

Alos see http://hypothesis.readthedocs.io/en/latest/data.html.

* Add and convert tests for HTTP requests

This commit introduces a few Hypothesis tests to test the HTTP request
part of the specification. To keep things organized, I split the
existing tests module into two: one concerned with requests, and one
concerned with responses. I anticipate that we'll also add modules for
chunks and server push later.

daphne already had tests for the HTTP protocol. Some of them I converted
to Hypothesis tests to increase what was tested. Some were also
concerned with HTTP responses, so they were moved to the new response
module. And three tests were concerned with proxy behaviour, which I
wasn't sure about, and I just kept them as-is, but also moved them
to the request tests.

* Fix byte string issue in Python 2

Twisted seems to return a byte string for the client and server IP
address. It is easily rectified by casting to the required unicode
string. Also added a test to ensure this is also handled correctly in
the X-Forwarded-For header parsing.

* Check order of header values

I'm in the process of updating the ASGI spec to require that the order
of header values is kept. To match that work, I'm adding matching
assertions to the tests.

The code unfortunately is not as elegant as I'd like, but then it's only
a result of the underlying HTTP spec.

* Suppress warning about slow test

The kitchen sink test expectedly can be slow. So far it wasn't slow
enough for hypothesis to trigger a warning, but today Travis must've had
a bad day. I think for this test is is acceptable to exceed hypothesis'
warning threshold.
2017-03-14 14:12:07 -07:00
Maik Hoepfel
cf94ec01fa Test against Python 3.4 and multiple Twisted versions (#75)
* Test against Python 3.4 and multiple Twisted versions

This commit adds tox to be able to test against different dependencies
locally. We agreed that Python 3.4 should be supported across all Channels
projects, so it is also added with this commit.

Furthermore, I think it makes sense to support a broad range of Twisted
releases, as users of daphne are not unlikely to have other Twisted code
running. It's not feasible to test against all releases since 16.0, and
it would require constant maintenance to add new releases as they come
out. So I opted to keep things simple for now, and only test against the
oldest supported and the current Twisted release.

I did consider @jpic's great idea from
https://github.com/django/daphne/pull/19 to just use tox to avoid having
to duplicate the dependency matrix. But it does lead to slower test runs
as it bypasses Travis' caching, and is slightly more verbose.

* Require asgiref 1.0 and use receive instead of receive_many

As both daphne and asgiref had a 1.0 release, I think it makes sense to
require the presumably more stable asgiref 1.0. It's also a good
occasion to fix the deprecation warnings when running the tests by
switching to receive instead of receive_many.

* Document supported Python and Twisted versions
2017-01-30 17:24:17 -08:00
Sean Mc Allister
e38c7541da Merge remote-tracking branch 'upstream/master' into ticket_10 2016-10-21 17:51:52 +02:00
Adam Chainz
5a5fd08633 Tidy up setup.py a bit
* Remove unused import 'sys'
* Github is HTTPS
* Add some trove classifiers based upon Django's
2016-09-22 22:28:55 +01:00
Andrew Godwin
2176b209f7 Django-ification 2016-09-09 13:27:25 +01:00
Andrew Godwin
0b37e80614 Add attribute check for #31 and remove version pin 2016-08-28 11:14:13 -07:00
Sean Mc Allister
95351ffebb use twisted endpoint description strings to bind to ports and sockets 2016-08-11 17:52:27 +02:00
Andrew Godwin
d17394e84c Releasing 0.14.2 2016-07-07 16:58:12 -07:00
Andrew Godwin
105e914468 Releasing version 0.12.0 2016-05-07 13:01:05 -07:00
Andrew Godwin
a5946922f5 Releasing version 0.10 2016-03-21 16:45:24 -07:00
Andrew Godwin
b5400d0be5 Update setup a little 2016-02-21 13:17:17 +00:00
Andrew Godwin
bac3c14bfa Fix python 3 support 2016-02-05 17:23:49 -08:00
Andrew Godwin
88d47df276 Initial commit 2015-12-23 17:05:15 +00:00