git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #154265 from fabaff/fix-qcs-api-client

python3Packages.qcs-api-client: enable tests

commite5205c71575bedd1ceaec47a8c0e6a6d65db5902 authorFabian Affolter <fabian@affolter-engineering.ch> dateTue 11 Jan 2022, 11:28 (5 years ago) parent7846f7a009f8ca
3 files changed+41−13
pkgs/development/python-modules/cirq-google/default.nix+6−1 pkgs/development/python-modules/cirq-rigetti/default.nix+3−1 pkgs/development/python-modules/qcs-api-client/default.nix+32−11
pkgs/development/python-modules/cirq-google/default.nix+6−1
@@ -15,7 +15,6 @@ buildPythonPackage rec {
1515
1616 postPatch = ''
1717 substituteInPlace requirements.txt \
18− --replace "protobuf~=3.13.0" "protobuf" \
1918 --replace "google-api-core[grpc] >= 1.14.0, < 2.0.0dev" "google-api-core[grpc] >= 1.14.0, < 3.0.0dev"
2019 '';
2120
@@ -29,4 +28,10 @@ buildPythonPackage rec {
2928 freezegun
3029 pytestCheckHook
3130 ];
31+
32+ disabledTests = [
33+ # unittest.mock.InvalidSpecError: Cannot autospec attr 'QuantumEngineServiceClient'
34+ "test_get_engine_sampler_explicit_project_id"
35+ "test_get_engine_sampler"
36+ ];
3237}
pkgs/development/python-modules/cirq-rigetti/default.nix+3−1
@@ -40,7 +40,9 @@ buildPythonPackage rec {
4040 --replace "httpx~=0.15.5" "httpx" \
4141 --replace "idna~=2.10" "idna" \
4242 --replace "pyjwt~=1.7.1" "pyjwt" \
43− --replace "qcs-api-client~=0.8.0" "qcs-api-client"
43+ --replace "qcs-api-client~=0.8.0" "qcs-api-client" \
44+ --replace "iso8601~=0.1.14" "iso8601" \
45+ --replace "pydantic~=1.8.2" "pydantic"
4446 # Remove outdated test
4547 rm cirq_rigetti/service_test.py
4648 '';
pkgs/development/python-modules/qcs-api-client/default.nix+32−11
@@ -1,9 +1,11 @@
11{ lib
22, attrs
33, buildPythonPackage
4−, fetchPypi
4+, fetchFromGitHub
5+, fetchpatch
56, httpx
67, iso8601
8+, poetry-core
79, pydantic
810, pyjwt
911, pytest-asyncio
@@ -19,15 +21,21 @@
1921buildPythonPackage rec {
2022 pname = "qcs-api-client";
2123 version = "0.20.9";
22− format = "setuptools";
24+ format = "pyproject";
2325
2426 disabled = pythonOlder "3.7";
2527
26− src = fetchPypi {
27− inherit pname version;
28− sha256 = "7b4e890ca9d9996060690629eee88db49c5fa4bde520910d48dd20323d1c5574";
28+ src = fetchFromGitHub {
29+ owner = "rigetti";
30+ repo = "qcs-api-client-python";
31+ rev = "v${version}";
32+ hash = "sha256-bQ+5TZzjxGnNRsENEW/sN7sF6SOcgWl4MFtLekD0D+8=";
2933 };
3034
35+ nativeBuildInputs = [
36+ poetry-core
37+ ];
38+
3139 propagatedBuildInputs = [
3240 attrs
3341 httpx
@@ -46,15 +54,28 @@ buildPythonPackage rec {
4654 respx
4755 ];
4856
57+ patches = [
58+ # Switch to poetry-core, https://github.com/rigetti/qcs-api-client-python/pull/2
59+ (fetchpatch {
60+ name = "switch-to-poetry-core.patch";
61+ url = "https://github.com/rigetti/qcs-api-client-python/commit/32f0b3c7070a65f4edf5b2552648d88435469e44.patch";
62+ sha256 = "sha256-mOc+Q/5cmwPziojtxeEMWWHSDvqvzZlNRbPtOSeTinQ=";
63+ })
64+ ];
65+
4966 postPatch = ''
50− substituteInPlace setup.py \
51− --replace "attrs>=20.1.0,<21.0.0" "attrs" \
52− --replace "httpx>=0.15.0,<0.16.0" "httpx" \
53− --replace "pyjwt>=1.7.1,<2.0.0" "pyjwt"
67+ substituteInPlace pyproject.toml \
68+ --replace 'attrs = "^20.1.0"' 'attrs = "*"' \
69+ --replace 'httpx = "^0.15.0"' 'httpx = "*"' \
70+ --replace 'iso8601 = "^0.1.13"' 'iso8601 = "*"' \
71+ --replace 'pydantic = "^1.7.2"' 'pydantic = "*"' \
72+ --replace 'pyjwt = "^1.7.1"' 'pyjwt = "*"'
5473 '';
5574
56− # Project has no tests
57− doCheck = false;
75+ disabledTestPaths = [
76+ # Test is outdated
77+ "tests/test_client/test_client.py"
78+ ];
5879
5980 pythonImportsCheck = [
6081 "qcs_api_client"