Skip to content

Commit

Permalink
test: add explicit no wheel grpcio test
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and adisbladis committed Feb 27, 2023
1 parent 07e74f9 commit 4171ef6
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 10 deletions.
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,6 @@ builtins.removeAttrs
virtualenv-pre-20-18 = callTest ./virtualenv-pre-20-18 { };
virtualenv-post-20-18 = callTest ./virtualenv-post-20-18 { };
grpcio-wheel = callTest ./grpcio-wheel { };
grpcio-no-wheel = callTest ./grpcio-no-wheel { };
}
skipTests
22 changes: 22 additions & 0 deletions tests/grpcio-no-wheel/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ lib, poetry2nix, python3, runCommand }:
let
env = poetry2nix.mkPoetryEnv {
python = python3;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
preferWheels = true;
overrides = poetry2nix.overrides.withDefaults (
self: super: {
grpcio = super.grpcio.override {
preferWheel = false;
};
}
);
};

isWheelGrpcIO = env.python.pkgs.grpcio.src.isWheel;

in
assert (!isWheelGrpcIO); runCommand "grpcio-wheel" { } ''
${env}/bin/python -c 'import grpc; print(grpc.__version__)' > $out
''
64 changes: 64 additions & 0 deletions tests/grpcio-no-wheel/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions tests/grpcio-no-wheel/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tool.poetry]
name = "test-grpcio-wheel"
version = "0.1.0"
description = "Test of wheel for grpcio"
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
grpcio = "^1.51.1"

[build-system]
requires = ["poetry-core>=1"]
build-backend = "poetry.core.masonry.api"
19 changes: 9 additions & 10 deletions tests/grpcio-wheel/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@ let
python = python3;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
overrides = poetry2nix.overrides.withDefaults
# This is also in overrides.nix but repeated for completeness
(
self: super: {
grpcio = super.grpcio.override {
preferWheel = true;
};
}
);
preferWheels = false;
overrides = poetry2nix.overrides.withDefaults (
self: super: {
grpcio = super.grpcio.override {
preferWheel = true;
};
}
);
};

isWheelGrpcIO = env.python.pkgs.grpcio.src.isWheel or false;
isWheelGrpcIO = env.python.pkgs.grpcio.src.isWheel;

in
assert isWheelGrpcIO; runCommand "grpcio-wheel" { } ''
Expand Down

0 comments on commit 4171ef6

Please sign in to comment.