@@ -1,6 +1,6 @@
11{ lib
22, buildPythonPackage
3−, fetchPypi
3+, fetchFromGitHub
44, setuptools
55, pytz
66, tzlocal
@@ -10,15 +10,20 @@
1010, freezegun
1111, mock
1212, nose
13+, pytestCheckHook
14+, pytest-xdist
1315}:
1416
1517buildPythonPackage rec {
1618 pname = "clickhouse-driver";
1719 version = "0.2.0";
1820
19− src = fetchPypi {
20− inherit pname version;
21− sha256 = "62d37f93872d5a13eb6b0d52bab2b593ed0e14cf9200949aa2d02f9801064c0f";
21+ # pypi source doesn't contain tests
22+ src = fetchFromGitHub {
23+ owner = "mymarilyn";
24+ repo = "clickhouse-driver";
25+ rev = "96b7ba448c63ca2670cc9aa70d4a0e08826fb650";
26+ sha256 = "sha256-HFKUxJOlBCVlu7Ia8heGpwX6+HdKuwSy92s3v+GKGwE=";
2227 };
2328
2429 propagatedBuildInputs = [
@@ -34,9 +39,30 @@ buildPythonPackage rec {
3439 freezegun
3540 mock
3641 nose
42+ pytest-xdist
43+ pytestCheckHook
3744 ];
3845
39− doCheck = true;
46+ postPatch = ''
47+ substituteInPlace setup.py \
48+ --replace "lz4<=3.0.1" "lz4<=4"
49+ '';
50+
51+ # remove source to prevent pytest testing source instead of the build artifacts
52+ # (the source doesn't contain the extension modules)
53+ preCheck = ''
54+ rm -rf clickhouse_driver
55+ '';
56+
57+ # some test in test_buffered_reader.py doesn't seem to return
58+ disabledTestPaths = [ "tests/test_buffered_reader.py" ];
59+
60+ pytestFlagsArray = [ "-n" "$NIX_BUILD_CORES" ];
61+
62+ # most tests require `clickhouse`
63+ # TODO: enable tests after `clickhouse` unbroken
64+ doCheck = false;
65+
4066 pythonImportsCheck = [ "clickhouse_driver" ];
4167
4268 meta = with lib; {