Skip to content

Commit fa0cc8a

Browse files
thunzetm-drtina
authored andcommitted
python313Packages.tkinter: fix test selection for darwin, older python
python/cpython#94070
1 parent c8f5f92 commit fa0cc8a

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

pkgs/development/python-modules/tkinter/default.nix

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
lib,
3+
stdenv,
34
buildPythonPackage,
45
replaceVars,
56
setuptools,
@@ -63,20 +64,42 @@ buildPythonPackage {
6364
];
6465
};
6566

66-
nativeCheckInputs = [ xvfb-run ];
67+
nativeCheckInputs = lib.optional stdenv.hostPlatform.isLinux xvfb-run;
6768

6869
preCheck = ''
6970
cd $NIX_BUILD_TOP/Python-*/Lib
7071
export HOME=$TMPDIR
7172
'';
7273

73-
checkPhase = ''
74-
runHook preCheck
75-
xvfb-run -w 10 -s "-screen 0 1920x1080x24" \
76-
python -m unittest test.test_tcl test.test_tkinter test.test_ttk test.test_ttk_textonly
77-
78-
runHook postCheck
79-
'';
74+
checkPhase =
75+
let
76+
testsNoGui = [
77+
"test.test_tcl"
78+
"test.test_ttk_textonly"
79+
];
80+
testsGui =
81+
if pythonOlder "3.12" then
82+
[
83+
"test.test_tk"
84+
# "test.test_ttk_guionly" # https://github.com/python/cpython/issues/124378
85+
]
86+
else
87+
[
88+
"test.test_tkinter"
89+
"test.test_ttk"
90+
];
91+
in
92+
''
93+
runHook preCheck
94+
${python.interpreter} -m unittest ${lib.concatStringsSep " " testsNoGui}
95+
''
96+
+ lib.optionalString stdenv.hostPlatform.isLinux ''
97+
xvfb-run -w 10 -s "-screen 0 1920x1080x24" \
98+
${python.interpreter} -m unittest ${lib.concatStringsSep " " testsGui}
99+
''
100+
+ ''
101+
runHook postCheck
102+
'';
80103

81104
pythonImportsCheck = [ "tkinter" ];
82105

0 commit comments

Comments
 (0)