Python: Add integration test verifying NIX_PYTHONPATH with Mypy

This commit is contained in:
adisbladis
2020-03-14 16:16:20 +00:00
parent 05571d3059
commit 753122388d
7 changed files with 66 additions and 1 deletions

View File

@@ -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
''

View File

@@ -0,0 +1,11 @@
{ buildPythonPackage }:
buildPythonPackage {
pname = "typeddep";
version = "1.3.3.7";
src = ./.;
}

View File

@@ -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',
})

View File

@@ -0,0 +1,2 @@
def echo(s: str) -> str:
return s