evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / development / python-modules / pymongo-inmemory / default.nix
blob431b08d76af225e64ee6d55ac50e5c355d5be68f
2   lib,
3   buildPythonPackage,
4   pythonOlder,
5   fetchFromGitHub,
6   poetry-core,
7   pymongo,
8   pytestCheckHook,
9 }:
11 buildPythonPackage rec {
12   pname = "pymongo-inmemory";
13   version = "0.4.2";
14   format = "pyproject";
16   disabled = pythonOlder "3.7";
18   src = fetchFromGitHub {
19     owner = "kaizendorks";
20     repo = "pymongo_inmemory";
21     rev = "refs/tags/v${version}";
22     hash = "sha256-FDHHf9x62EqNcHjDF2vH8w8WG/15efEe+fDqGiiOe4A=";
23   };
25   postPatch = ''
26     # move cache location from nix store to home
27     substituteInPlace pymongo_inmemory/context.py \
28       --replace-fail \
29         'CACHE_FOLDER = path.join(path.dirname(__file__), "..", ".cache")' \
30         'CACHE_FOLDER = os.environ.get("XDG_CACHE_HOME", os.environ["HOME"] + "/.cache") + "/pymongo-inmemory"'
32     # fix a broken assumption arising from the above fix
33     substituteInPlace pymongo_inmemory/_utils.py \
34       --replace-fail \
35         'os.mkdir(current_path)' \
36         'os.makedirs(current_path)'
37   '';
39   nativeBuildInputs = [ poetry-core ];
41   dependencies = [ pymongo ];
43   nativeCheckInputs = [ pytestCheckHook ];
45   disabledTestPaths = [
46     # new test with insufficient monkey patching, try to remove on next bump
47     "tests/unit/test_mongod.py"
48   ];
50   preCheck = ''
51     export HOME="$(mktemp -d)"
52   '';
54   pythonImportsCheck = [ "pymongo_inmemory" ];
56   meta = {
57     homepage = "https://github.com/kaizendorks/pymongo_inmemory";
58     description = "Mongo mocking library with an ephemeral MongoDB running in memory";
59     maintainers = with lib.maintainers; [ pbsds ];
60     license = lib.licenses.mit;
61   };