diff --git a/sample_environments.nix b/sample_environments.nix index 554838a..390c733 100644 --- a/sample_environments.nix +++ b/sample_environments.nix @@ -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; @@ -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; } diff --git a/tests/app/Spec/Tests/Python.hs b/tests/app/Spec/Tests/Python.hs index d23cea0..a27d1b0 100644 --- a/tests/app/Spec/Tests/Python.hs +++ b/tests/app/Spec/Tests/Python.hs @@ -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 @@ -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 @@ -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 {