git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #120881 from AluisioASG/aasg/sanic-routing

python3Packages.sanic: 21.3.2 -> 21.3.4; fix tests

commitdc68eb58bb8d4dc3cfb8896932e6146c45579932 authorRobert Schütz <dev@schuetz-co.de> dateFri 30 Apr 2021, 15:20 (6 years ago) parente68f542bd815d2
5 files changed+104−17
pkgs/development/python-modules/pytest-sanic/default.nix+4 pkgs/development/python-modules/sanic-routing/default.nix+28 pkgs/development/python-modules/sanic-testing/default.nix+40 pkgs/development/python-modules/sanic/default.nix+18−16 pkgs/top-level/python-packages.nix+14−1
pkgs/development/python-modules/pytest-sanic/default.nix+4
@@ -46,5 +46,9 @@ buildPythonPackage rec {
4646 homepage = "https://github.com/yunstanford/pytest-sanic/";
4747 license = licenses.asl20;
4848 maintainers = [ maintainers.costrouc ];
49+ # pytest-sanic is incompatible with Sanic 21.3, see
50+ # https://github.com/sanic-org/sanic/issues/2095 and
51+ # https://github.com/yunstanford/pytest-sanic/issues/50.
52+ broken = lib.versionAtLeast sanic.version "21.3.0";
4953 };
5054}
pkgs/development/python-modules/sanic-routing/default.nixnew file+28
@@ -0,0 +1,28 @@
1+{ lib
2+, buildPythonPackage
3+, fetchFromGitHub
4+, pytestCheckHook
5+, pytest-asyncio
6+}:
7+
8+buildPythonPackage rec {
9+ pname = "sanic-routing";
10+ version = "0.6.2";
11+
12+ src = fetchFromGitHub {
13+ owner = "sanic-org";
14+ repo = "sanic-routing";
15+ rev = "v${version}";
16+ hash = "sha256-ZMl8PB9E401pUfUJ4tW7nBx1TgPQQtx9erVni3zP+lo=";
17+ };
18+
19+ checkInputs = [ pytestCheckHook pytest-asyncio ];
20+ pythonImportsCheck = [ "sanic_routing" ];
21+
22+ meta = with lib; {
23+ description = "Core routing component for the Sanic web framework";
24+ homepage = "https://github.com/sanic-org/sanic-routing";
25+ license = licenses.mit;
26+ maintainers = with maintainers; [ AluisioASG ];
27+ };
28+}
pkgs/development/python-modules/sanic-testing/default.nixnew file+40
@@ -0,0 +1,40 @@
1+{ lib
2+, buildPythonPackage
3+, fetchFromGitHub
4+, pytestCheckHook
5+, httpcore
6+, httpx
7+, pytest-asyncio
8+, sanic
9+, websockets
10+}:
11+
12+buildPythonPackage rec {
13+ pname = "sanic-testing";
14+ version = "0.3.1";
15+
16+ src = fetchFromGitHub {
17+ owner = "sanic-org";
18+ repo = "sanic-testing";
19+ rev = "v${version}";
20+ hash = "sha256-hBAq+/BKs0a01M89Nb8HaClqxB+W5PTfjVzef/m9SWs=";
21+ };
22+
23+ propagatedBuildInputs = [ httpx sanic websockets httpcore ];
24+
25+ # `sanic` is explicitly set to null when building `sanic` itself
26+ # to prevent infinite recursion. In that case we skip running
27+ # the package at all.
28+ doCheck = sanic != null;
29+ dontUsePythonImportsCheck = sanic == null;
30+
31+ checkInputs = [ pytestCheckHook pytest-asyncio ];
32+ pythonImportsCheck = [ "sanic_testing" ];
33+
34+ meta = with lib; {
35+ description = "Core testing clients for the Sanic web framework";
36+ homepage = "https://github.com/sanic-org/sanic-testing";
37+ license = licenses.mit;
38+ maintainers = with maintainers; [ AluisioASG ];
39+ };
40+}
pkgs/development/python-modules/sanic/default.nix+18−16
@@ -1,42 +1,44 @@
11{ lib, buildPythonPackage, fetchPypi, doCheck ? true
2−, aiofiles, httptools, httpx, multidict, ujson, uvloop, websockets
3−, pytestCheckHook, beautifulsoup4, gunicorn, httpcore, uvicorn
4−, pytest-asyncio, pytest-benchmark, pytest-dependency, pytest-sanic, pytest-sugar, pytestcov
2+, aiofiles, httptools, multidict, sanic-routing, ujson, uvloop, websockets
3+, pytestCheckHook, beautifulsoup4, gunicorn, uvicorn, sanic-testing
4+, pytest-benchmark, pytest-sanic, pytest-sugar, pytestcov
55}:
66
77buildPythonPackage rec {
88 pname = "sanic";
9− version = "21.3.2";
9+ version = "21.3.4";
1010
1111 src = fetchPypi {
1212 inherit pname version;
13− sha256 = "84a04c5f12bf321bed3942597787f1854d15c18f157aebd7ced8c851ccc49e08";
13+ sha256 = "1cbd12b9138b3ca69656286b0be91fff02b826e8cb72dd76a2ca8c5eb1288d8e";
1414 };
1515
1616 postPatch = ''
17+ # Loosen dependency requirements.
1718 substituteInPlace setup.py \
18− --replace '"multidict==5.0.0"' '"multidict"' \
19− --replace '"httpx==0.15.4"' '"httpx"' \
20− --replace '"httpcore==0.3.0"' '"httpcore"' \
21− --replace '"pytest==5.2.1"' '"pytest"'
19+ --replace '"pytest==5.2.1"' '"pytest"' \
20+ --replace '"gunicorn==20.0.4"' '"gunicorn"' \
21+ --replace '"pytest-sanic",' ""
22+ # Patch a request headers test to allow brotli encoding
23+ # (we build httpx with brotli support, upstream doesn't).
24+ substituteInPlace tests/test_headers.py \
25+ --replace "deflate\r\n" "deflate, br\r\n"
2226 '';
2327
2428 propagatedBuildInputs = [
25− aiofiles httptools httpx multidict ujson uvloop websockets
29+ sanic-routing httptools uvloop ujson aiofiles websockets multidict
2630 ];
2731
2832 checkInputs = [
29− pytestCheckHook beautifulsoup4 gunicorn httpcore uvicorn
30− pytest-asyncio pytest-benchmark pytest-dependency pytest-sanic pytest-sugar pytestcov
33+ sanic-testing gunicorn pytestcov beautifulsoup4 pytest-sanic pytest-sugar
34+ pytest-benchmark pytestCheckHook uvicorn
3135 ];
3236
3337 inherit doCheck;
3438
3539 disabledTests = [
3640 "test_gunicorn" # No "examples" directory in pypi distribution.
37− "test_logo" # Fails to filter out "DEBUG asyncio:selector_events.py:59 Using selector: EpollSelector"
3841 "test_zero_downtime" # No "examples.delayed_response.app" module in pypi distribution.
39− "test_reloader_live" # OSError: [Errno 98] error while attempting to bind on address ('127.0.0.1', 42104)
4042 ];
4143
4244 __darwinAllowLocalNetworking = true;
@@ -45,8 +47,8 @@ buildPythonPackage rec {
4547
4648 meta = with lib; {
4749 description = "A microframework based on uvloop, httptools, and learnings of flask";
48− homepage = "https://github.com/channelcat/sanic/";
50+ homepage = "https://github.com/sanic-org/sanic/";
4951 license = licenses.mit;
50− maintainers = [ maintainers.costrouc ];
52+ maintainers = with maintainers; [ costrouc AluisioASG ];
5153 };
5254}
pkgs/top-level/python-packages.nix+14−1
@@ -7195,9 +7195,22 @@ in {
71957195
71967196 samsungtvws = callPackage ../development/python-modules/samsungtvws { };
71977197
7198+ sanic = callPackage ../development/python-modules/sanic {
7199+ # pytest-sanic is doing ok for the sole purpose of testing Sanic.
7200+ pytest-sanic = self.pytest-sanic.overridePythonAttrs (oldAttrs: {
7201+ doCheck = false;
7202+ meta.broken = false;
7203+ });
7204+ # Don't pass any `sanic` to avoid dependency loops. `sanic-testing`
7205+ # has special logic to disable tests when this is the case.
7206+ sanic-testing = self.sanic-testing.override { sanic = null; };
7207+ };
7208+
71987209 sanic-auth = callPackage ../development/python-modules/sanic-auth { };
71997210
7200− sanic = callPackage ../development/python-modules/sanic { };
7211+ sanic-routing = callPackage ../development/python-modules/sanic-routing { };
7212+
7213+ sanic-testing = callPackage ../development/python-modules/sanic-testing { };
72017214
72027215 sapi-python-client = callPackage ../development/python-modules/sapi-python-client { };
72037216