Merge pull request #247868 from doronbehar/pkg/python-tk-test

python.tests.tkinter: init
This commit is contained in:
Theodore Ni 2023-08-19 04:04:24 -07:00 committed by GitHub
commit 4ed77bebec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -114,6 +114,10 @@ let
nix-pythonprefix-mypy = callPackage ./tests/test_nix_pythonprefix {
interpreter = python;
};
# Make sure tkinter is importable. See https://github.com/NixOS/nixpkgs/issues/238990
tkinter = callPackage ./tests/test_tkinter {
interpreter = python;
};
}
);

View File

@ -0,0 +1,17 @@
{ interpreter, writeText, runCommand }:
let
pythonEnv = interpreter.withPackages(ps: [
ps.tkinter
]);
pythonScript = writeText "myscript.py" ''
import tkinter
print(tkinter)
'';
in runCommand "${interpreter.name}-tkinter-test" {} ''
${pythonEnv}/bin/python ${pythonScript}
touch $out
''