Python: Add integration test verifying NIX_PYTHONPATH with Mypy
This commit is contained in:
parent
05571d3059
commit
753122388d
|
@ -2,6 +2,7 @@
|
|||
, runCommand
|
||||
, substituteAll
|
||||
, lib
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -50,6 +51,14 @@ let
|
|||
# };
|
||||
};
|
||||
|
||||
# All PyPy package builds are broken at the moment
|
||||
integrationTests = lib.optionalAttrs (python.isPy3k && (!python.isPyPy)) rec {
|
||||
# Before the addition of NIX_PYTHONPREFIX mypy was broken with typed packages
|
||||
nix-pythonprefix-mypy = callPackage ./tests/test_nix_pythonprefix {
|
||||
interpreter = python;
|
||||
};
|
||||
};
|
||||
|
||||
testfun = name: attrs: runCommand "${python.name}-tests-${name}" ({
|
||||
inherit (python) pythonVersion;
|
||||
} // attrs) ''
|
||||
|
@ -61,4 +70,4 @@ let
|
|||
touch $out/success
|
||||
'';
|
||||
|
||||
in lib.mapAttrs testfun envs
|
||||
in lib.mapAttrs testfun envs // integrationTests
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
{ interpreter, writeText, runCommandNoCC }:
|
||||
|
||||
let
|
||||
|
||||
python = let
|
||||
packageOverrides = self: super: {
|
||||
typeddep = super.callPackage ./typeddep {};
|
||||
};
|
||||
in interpreter.override {inherit packageOverrides; self = python;};
|
||||
|
||||
pythonEnv = python.withPackages(ps: [
|
||||
ps.typeddep
|
||||
ps.mypy
|
||||
]);
|
||||
|
||||
pythonScript = writeText "myscript.py" ''
|
||||
from typeddep import util
|
||||
s: str = util.echo("hello")
|
||||
print(s)
|
||||
'';
|
||||
|
||||
in runCommandNoCC "${interpreter.name}-site-prefix-mypy-test" {} ''
|
||||
${pythonEnv}/bin/mypy ${pythonScript}
|
||||
touch $out
|
||||
''
|
|
@ -0,0 +1,11 @@
|
|||
{ buildPythonPackage }:
|
||||
|
||||
|
||||
buildPythonPackage {
|
||||
|
||||
pname = "typeddep";
|
||||
version = "1.3.3.7";
|
||||
|
||||
src = ./.;
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
from setuptools import setup
|
||||
|
||||
setup(**{
|
||||
'name': 'typeddep',
|
||||
'version': '1.3.3.7',
|
||||
'description': 'Minimal repro to test mypy and site prefixes with Nix',
|
||||
'long_description': None,
|
||||
'author': 'adisbladis',
|
||||
'author_email': 'adisbladis@gmail.com',
|
||||
'maintainer': None,
|
||||
'maintainer_email': None,
|
||||
'url': None,
|
||||
'packages': ['typeddep'],
|
||||
'package_data': {'': ['*']},
|
||||
'install_requires': [],
|
||||
'entry_points': {},
|
||||
'python_requires': '>=3.7,<4.0',
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
def echo(s: str) -> str:
|
||||
return s
|
Loading…
Reference in New Issue