Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion sample_environments.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
go = import ./sample_environments/go.nix args;
octave = import ./sample_environments/octave.nix args;
postgres = import ./sample_environments/postgres.nix args;
pypy3 = import ./sample_environments/pypy3.nix args;
r = import ./sample_environments/r.nix args;
r-ark = import ./sample_environments/r-ark.nix args;
ruby_3_3 = import ./sample_environments/ruby_3_3.nix args;
Expand All @@ -42,4 +41,8 @@
python312 = import ./sample_environments/python312.nix args;
python313 = import ./sample_environments/python313.nix args;
python3 = import ./sample_environments/python3.nix args;
} // pkgsStable.lib.optionalAttrs pkgsStable.stdenv.targetPlatform.isLinux {
# PyPy's bootstrap interpreter doesn't build on Darwin: its libffi calls are guarded by
# -Wunguarded-availability-new against a deployment target older than macOS 10.15.
pypy3 = import ./sample_environments/pypy3.nix args;
}
11 changes: 8 additions & 3 deletions tests/app/Spec/Tests/Python.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

module Spec.Tests.Python (tests) where

import Control.Monad (when)
import Data.String.Interpolate
import Data.Text
import Language.LSP.Protocol.Types
import System.Info (os)
import Test.Sandwich as Sandwich
import TestLib.JupyterRunnerContext
import TestLib.LSP
Expand All @@ -26,7 +28,8 @@ tests = describe "Python" $ parallel $ do
tests' ("python3", "python313")
-- tests' ("python3", "python314")

pypyTests
-- PyPy's bootstrap interpreter doesn't build on Darwin, so there's no kernel to test there.
when (os /= "darwin") pypyTests

tests' :: (Text, Text) -> LanguageSpec
tests' (kernelName, pythonPackage) = introduceNixEnvironment [kernelSpec kernelName pythonPackage] [] [i|Python (#{pythonPackage})|] $ introduceJupyterRunner $ do
Expand Down Expand Up @@ -76,10 +79,12 @@ tests' (kernelName, pythonPackage) = introduceNixEnvironment [kernelSpec kernelN
-- rather than the package and language server stack the CPython tests exercise.
pypyTests :: LanguageSpec
pypyTests = introduceNixEnvironment [pypyKernelSpec] [] "Python (pypy3)" $ introduceJupyterRunner $ do
-- The Nix attribute is kernels.pypy3, but the kernel it installs is named python3, the
-- same as the CPython ones.
testHasExpectedFields "pypy3"

testKernelStdout "pypy3" [i|print("hi")|] "hi\n"
testKernelStdout "pypy3" [i|import platform; print(platform.python_implementation())|] "PyPy\n"
testKernelStdout "python3" [i|print("hi")|] "hi\n"
testKernelStdout "python3" [i|import platform; print(platform.python_implementation())|] "PyPy\n"

pypyKernelSpec :: NixKernelSpec
pypyKernelSpec = NixKernelSpec {
Expand Down
Loading