functional2 test_toml_invalid_argument_types fails due to PATH shenanigans (on macOS?) #964

Open
opened 2025-08-17 16:28:12 +00:00 by jade · 8 comments
Owner

on 3de996f5:

tests/functional2 » pytest -k toml_invalid --pdb      
======================================= test session starts =======================================
platform darwin -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0
rootdir: /Users/jade/lix/lix/tests/functional2
configfile: pyproject.toml
plugins: xdist-3.6.1
collecting ... 
--------------------------------------- live log collection ---------------------------------------
2025-08-17T18:12:04Z [    INFO] [lang-test-collector] skipping /Users/jade/lix/lix/tests/functional
2/lang/err_context as it contains a py file, assuming custom tests
collected 266 items / 265 deselected / 1 selected                                                 

lang/test_lang_infra.py::test_toml_invalid_argument_types[files0-pytest_command0] 
------------------------------------------ live log call ------------------------------------------
2025-08-17T18:12:04Z [   ERROR] [functional2.testlib.fixtures.command] stdout: ====================
========= test session starts ==============================
platform darwin -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0
rootdir: /private/var/folders/tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/pytest-of-jade/pytest-27/test_tom
l_invalid_argument_typ0/test-home/functional2
configfile: pyproject.toml
collected 0 items / 1 error

==================================== ERRORS ====================================
______________________ ERROR collecting lang/test_lang.py ______________________
ImportError while importing test module '/private/var/folders/tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/p
ytest-of-jade/pytest-27/test_toml_invalid_argument_typ0/test-home/functional2/lang/test_lang.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/nix/store/v0vy1c59f0vf71h64caw17hzymvg0zms-python3-3.12.10/lib/python3.12/importlib/__init__.py:90
: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
lang/test_lang.py:7: in <module>
    import yaml
E   ModuleNotFoundError: No module named 'yaml'
=========================== short test summary info ============================
ERROR lang/test_lang.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.04s ===============================

2025-08-17T18:12:04Z [   ERROR] [functional2.testlib.fixtures.command] stderr: 
FAILED                                                                                      [100%]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> captured log >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ERROR    functional2.testlib.fixtures.command:command.py:45 stdout: ============================= t
est session starts ==============================
platform darwin -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0
rootdir: /private/var/folders/tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/pytest-of-jade/pytest-27/test_tom
l_invalid_argument_typ0/test-home/functional2
configfile: pyproject.toml
collected 0 items / 1 error

==================================== ERRORS ====================================
______________________ ERROR collecting lang/test_lang.py ______________________
ImportError while importing test module '/private/var/folders/tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/p
ytest-of-jade/pytest-27/test_toml_invalid_argument_typ0/test-home/functional2/lang/test_lang.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/nix/store/v0vy1c59f0vf71h64caw17hzymvg0zms-python3-3.12.10/lib/python3.12/importlib/__init__.py:90
: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
lang/test_lang.py:7: in <module>
    import yaml
E   ModuleNotFoundError: No module named 'yaml'
=========================== short test summary info ============================
ERROR lang/test_lang.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.04s ===============================

ERROR    functional2.testlib.fixtures.command:command.py:46 stderr:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

pytest_command = Command(argv=['pytest', '--basetemp', '../pytest_files', '-k', 'toml_test'], _env=
<functional2.testlib.fixtures.env.Ma.../test_toml_invalid_argument_typ0/test-home/functional2'), _l
ogger=<Logger functional2.testlib.fixtures.command (INFO)>)

    @pytest.mark.parametrize(
        ("files", "pytest_command"),
        [
            (
                get_functional2_lang_files(
                    {
                        "functional2": {
                            "lang": {
                                "toml_test": {
                                    "in.nix": File("{}"),
                                    "my_name.out.exp": File("{ }\n"),
                                    "test.toml": File(
                                        dedent("""
                                        invalid_test = "eval-okay"
                                        [[test]]
                                        name = "my_name"
                                        runner = "eval-okay"
                                        flags = 1
                                        [[test]]
                                        name = "second"
                                        runner = "eval-okay"
                                        extra-files = [false, true, true]
                                        """)
                                    ),
                                }
                            }
                        }
                    }
                ),
                ["-k", "toml_test"],
            )
        ],
        indirect=True,
    )
    @pytest.mark.usefixtures("files")
    def test_toml_invalid_argument_types(pytest_command: Command):
>       result = pytest_command.run().expect(1)
E       subprocess.CalledProcessError: Command '['pytest', '--basetemp', '../pytest_files', '-k', '
toml_test']' returned non-zero exit status 2.

lang/test_lang_infra.py:438: CalledProcessError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /Users/jade/lix/lix/tests/functional2/lang/test_lang_infra.py(438)test_toml_invalid_argument_type
s()
-> result = pytest_command.run().expect(1)
(Pdb) p pytest_command
Command(argv=['pytest', '--basetemp', '../pytest_files', '-k', 'toml_test'], _env=<functional2.test
lib.fixtures.env.ManagedEnv object at 0x106aee930>, stdin=None, cwd=PosixPath('/private/var/folders
/tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/pytest-of-jade/pytest-27/test_toml_invalid_argument_typ0/test-
home/functional2'), _logger=<Logger functional2.testlib.fixtures.command (INFO)>)
(Pdb) p pytest_command._env._env
{'GIT_CONFIG_SYSTEM': '/dev/null', 'SHELL': '/bin/sh', 'PAGER': 'cat', 'BUILD_TEST_SHELL': '/bin', 
'_NIX_TEST_NO_SANDBOX': '1'}
(Pdb) p pytest_command.path
*** AttributeError: 'Command' object has no attribute 'path'
(Pdb) p pytest_command._env.path
_ManagedPath(_path=['/Users/jade/lix/lix/outputs/out/bin', 'None', '/nix/store/v0vy1c59f0vf71h64caw
17hzymvg0zms-python3-3.12.10/bin', '/nix/store/93znhry0ccspy50j4wq3jz93f73n2536-python3.12-pytest-8
.3.5/bin', '/nix/store/bc4kmk0axsjpqi2qb90prz48kgj9d3sh-pre-commit-4.0.1/bin', '/Users/jade/lix/lix
/outputs/out/bin', '/nix/store/d12c7ny0s98iiycg0b2a4pdqn6fg97a2-clang-tools-19.1.7/bin', '/nix/stor
e/g2r737j05jgy19c2yqnyvs71w8bxk4b1-bash-interactive-5.2p37/bin', '/nix/store/441zf0mh2603k3a9jqq2va
iv92d4iaix-check-syscalls/bin', '/nix/store/lwnzwp8382fqp3m28c5h9a0d7643qbhz-python3-3.12.10-env/bi
n', '/nix/store/j5fnid539kpg5dvnl2gpcibin39x558j-skopeo-1.18.0/bin', '/nix/store/4w4jqx6b693n45qfmw
iwn8qd58f08rgf-just-1.40.0/bin', '/nix/store/r1630if1xipdb4bzyibs8pb6g134laz5-nixfmt-unstable-2025-
04-04/bin', '/nix/store/2jrzw9y1f1ar6mc1hp4mcyqxr5j70bvp-doxygen-1.13.2/bin', '/nix/store/cvhbqa01i
5yy7xmmpqp1hbnvq7kpvgsx-clang-wrapper-19.1.7/bin', '/nix/store/5hgabdyqh22l57cb3qgx10lcc40d5n9p-cla
ng-19.1.7/bin', '/nix/store/d72z8b7fvvcin2p84x7h5s0abkggplzc-coreutils-9.7/bin', '/nix/store/k8q0n8
py04l07glgsfmvqqyqazxf04mb-cctools-binutils-darwin-wrapper-1010.6/bin', '/nix/store/idmz24ps83r9mz2
hkxdqwv6y4v2v7x28-cctools-binutils-darwin-1010.6/bin', '/nix/store/77dvdfdk9jhxd9bqn6k3djfbkas3i4fv
-clang-19.1.7-python/bin', '/nix/store/33kilxl6fnq2m5aqn61h4nrjr4v344xp-rust-analyzer-2025-05-12/bi
n', '/nix/store/v9kavzgzbym8adb6p7nxgid13jz76411-cargo-1.86.0/bin', '/nix/store/sg9421abrr6af5kcg50
gvyhlf11syhwv-rustc-wrapper-1.86.0/bin', '/nix/store/jgvccf4zr25v51ycxcplqrsfczixw3k5-rustfmt-1.86.
0/bin', '/nix/store/wbr8r10v6bi3xp1lc90ggf5n15s84y4m-llvm-19.1.7-dev/bin', '/nix/store/nh9z6y7agx6w
2lb72bvhwk1rlzp421n2-ncurses-6.5-dev/bin', '/nix/store/3578d0cacv8qb9mfp8na803svifqllrg-ncurses-6.5
/bin', '/nix/store/7ha8dv15lg62lcf9a6srnn58bcznnxbp-llvm-19.1.7/bin', '/nix/store/lzd8zgiggx9bkz5xc
b8k8rhvrcp7hiia-clang-19.1.7-dev/bin', '/nix/store/b7fp4z37adfq52dwzx1y54kdb5p9nwgz-python3.12-yq-3
.4.3/bin', '/nix/store/z6i95qv7cmz12wk2sbj9xblx9mm0mnwx-python3.12-argcomplete-3.5.3/bin', '/nix/st
ore/wy99fld1cyvkxb27p1piff1afhl8bgb0-python3.12-pre-commit-hooks-5.0.0/bin', '/nix/store/glv5r924n2
7cfwvzg3nskn8f3nqkwyrl-check-headers/bin', '/nix/store/y1h1992zyql0j53zq79mjxyhjam77qya-keep-sorted
-0.6.1/bin', '/nix/store/gp6apqj9rk421amj1idy4k37mx2j0adq-build-release-notes/bin', '/nix/store/8ls
v8mivnz7v3g98ilmfgps1gqviwhbv-treefmt/bin', '/nix/store/av7xsvkkf8h95g4041gf9vngwdwi5ybz-ruff-0.11.
10/bin', '/nix/store/cr8vgkja09m6fa5zn4v4xk5j7c1plgpy-clangbuildanalyzer-1.6.0/bin', '/nix/store/60
zw3h820l4k9pkzkhah47n26wj2ax3s-python3-3.12.10-env/bin', '/nix/store/5c7aacwalmwhq729byng6nlycva8qn
sf-meson-1.7.2/bin', '/nix/store/7xl5lynglh18jmk6s44q5win7n496yy4-ninja-1.12.1/bin', '/nix/store/44
6sv4sjjz03j7zw44icjbd81mfl8inx-cmake-3.31.6/bin', '/nix/store/qxms5w7hisdjd1l2pkvlk46fwwxk50v9-capn
proto-1.0.2/bin', '/nix/store/bx0b6gvphv01s2px3j1h1ajy036h8bgb-openssl-3.4.1-bin/bin', '/nix/store/
scff6xcwkhv6k09lxmkvapiiyj00mm8g-remove-references-to/bin', '/nix/store/23f5mz6zv5f4ld9ldpa32n6ammq
h9y4y-lowdown-unsandboxed-2.0.2/bin', '/nix/store/p6wzqya0w0z3vspkm8yyhpjv0da6fjn8-mdbook-0.4.49/bi
n', '/nix/store/b4y6nqivdfmr51jzfi21lgw98ai0gw42-mdbook-linkcheck-0.7.7/bin', '/nix/store/svafyjg9c
ly5zrq6hvbd34d14szvx2l7-pkg-config-wrapper-0.29.2/bin', '/nix/store/9pa6rygnkrdp03j4ba0w6yb5qid5x3q
b-git-2.49.0/bin', '/nix/store/izc36rp8i8rq5k1s3vm6xyyx7zs82425-mercurial-6.9.4/bin', '/nix/store/5
v1yqacl2lhgbrzgvbmnxbxah9pdyp2s-jq-1.7.1-bin/bin', '/nix/store/1ss2s2r7926y20i3f7h4ranri5r33qdk-lso
f-4.99.4/bin', '/nix/store/9y6b0s0z24zvc9mh4khzvk2f83n1ywjw-xcbuild-0.1.1-unstable-2019-11-20-xcrun
/bin', '/nix/store/hh6z6aagackr90b8148gmnzjch5x56h7-curl-8.13.0-dev/bin', '/nix/store/s9r15d8n23lk9
w6gbxa7m2n2pqqkjmsp-brotli-1.1.0/bin', '/nix/store/hw9ilqiiz2bc2k5hixql6x4bsbgms45y-krb5-1.21.3-dev
/bin', '/nix/store/a80mhqjpxk2sbmkasy94sdhmwcx4nsbl-krb5-1.21.3-lib/bin', '/nix/store/kys6dn2w4j6vf
45fiwp6r330w6yvzk3z-krb5-1.21.3/bin', '/nix/store/scyl00wx4xj1aghfw30r7f29dcdhk62b-nghttp2-1.65.0/b
in', '/nix/store/1hmsqq5nb15f8r2cxgc7pr64sh2xavqf-libidn2-2.3.8-bin/bin', '/nix/store/cwvaqj2nzi9ia
l9xil3hh0695q27wvdf-libpsl-0.21.5/bin', '/nix/store/qh89f5cm8fzy6wbk55wiinbds78v637d-zstd-1.5.7-bin
/bin', '/nix/store/bh18spw9agz58x6sycrkpr4piam7jb1d-zstd-1.5.7/bin', '/nix/store/j9l00pb7vjqichx1pb
9wh44mmpmsy5i8-curl-8.13.0-bin/bin', '/nix/store/7dvq6aba13kqkvj7ay850s4q806p33vw-bzip2-1.0.8-bin/b
in', '/nix/store/rmn4csq2fk0scys2d0v6hgkd3yv5fkxj-xz-5.8.1-bin/bin', '/nix/store/cq20rd1ci51s72zv7k
29h63clrj6rl0l-sqlite-3.48.0-bin/bin', '/nix/store/bcnx80h4bsb3bq91bq8q4k9f18s9kbga-libarchive-3.7.
8/bin', '/nix/store/6a3jg9bqj5hdjylvasq4ildgxhd26035-lowdown-2.0.2/bin', '/nix/store/fhza62gkyw0mp1
h2zls6pl1832zjjf26-libiconv-109/bin', '/nix/store/d72z8b7fvvcin2p84x7h5s0abkggplzc-coreutils-9.7/bi
n', '/nix/store/9gfvy5dd2kp4xf7m3k5gm79dx1mja2lj-findutils-4.10.0/bin', '/nix/store/wkgmvs8kl4a0xkr
1a1cs9m3hkn07zh5f-diffutils-3.12/bin', '/nix/store/3p81h24g11jfcdd7ifql71lr5mjag102-gnused-4.9/bin'
, '/nix/store/6rdq4hg48bmqy7d8da38niai5ngg1x1s-gnugrep-3.11/bin', '/nix/store/ip1m0zq8r95z6wbhk6l0k
32anw8h4kc7-gawk-5.3.2/bin', '/nix/store/0pfs35y6gzcd3bxiybl7vih5yfyv8bcl-gnutar-1.35/bin', '/nix/s
tore/29p1y63i1dxqspyrfima6s5ay6525zlf-gzip-1.14/bin', '/nix/store/7dvq6aba13kqkvj7ay850s4q806p33vw-
bzip2-1.0.8-bin/bin', '/nix/store/wkq7f52a2xq4n24f545wy2fidm4z14f2-gnumake-4.4.1/bin', '/nix/store/
8ivrpmp3arvxbr6imdwm2d28q9cjsqvi-bash-5.2p37/bin', '/nix/store/n1i5qvy1jcblq3s1ilnmc83yqcl0l8vk-pat
ch-2.7.6/bin', '/nix/store/rmn4csq2fk0scys2d0v6hgkd3yv5fkxj-xz-5.8.1-bin/bin', '/nix/store/bpibjj5f
5z5p73afivj0ljzbpdgnjbi0-file-5.46/bin', '/Users/jade/lix/lix/.direnv/bin', '/Users/jade/.nix-profi
le/bin', '/nix/var/nix/profiles/default/bin', '/Users/jade/.nix-profile/bin', '/Users/jade/bin', '/
Users/jade/.local/bin', '/usr/local/bin', '/usr/local/sbin', '/usr/bin', '/bin', '/usr/sbin', '/sbi
n', '/Applications/iTerm.app/Contents/Resources/utilities', '/Users/jade/esp/xtensa-esp32-elf/bin',
 '/Users/jade/.npm-packages/bin', '/Users/jade/.cargo/bin'])
(Pdb) 


===================================== short test summary info =====================================
FAILED lang/test_lang_infra.py::test_toml_invalid_argument_types[files0-pytest_command0] - subproce
ss.CalledProcessError: Command '['pytest', '--basetemp', '../pytest_files', '-k', 'tom...
!!!!!!!!!!!!!!!!!!!!!!!!!!!! _pytest.outcomes.Exit: Quitting debugger !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================== 1 failed, 265 deselected in 71.21s (0:01:11) ===========================

tests/functional2 » which pytest  
/nix/store/lwnzwp8382fqp3m28c5h9a0d7643qbhz-python3-3.12.10-env/bin/pytest

Basically it seems like the pytest being used recursively is not the same pytest as the one that's being used not-recursively. This is probably because the pytest being invoked not-recursively is putting a bad pytest into the head of PATH.

cc @helle.

on 3de996f5: ``` tests/functional2 » pytest -k toml_invalid --pdb ======================================= test session starts ======================================= platform darwin -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0 rootdir: /Users/jade/lix/lix/tests/functional2 configfile: pyproject.toml plugins: xdist-3.6.1 collecting ... --------------------------------------- live log collection --------------------------------------- 2025-08-17T18:12:04Z [ INFO] [lang-test-collector] skipping /Users/jade/lix/lix/tests/functional 2/lang/err_context as it contains a py file, assuming custom tests collected 266 items / 265 deselected / 1 selected lang/test_lang_infra.py::test_toml_invalid_argument_types[files0-pytest_command0] ------------------------------------------ live log call ------------------------------------------ 2025-08-17T18:12:04Z [ ERROR] [functional2.testlib.fixtures.command] stdout: ==================== ========= test session starts ============================== platform darwin -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0 rootdir: /private/var/folders/tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/pytest-of-jade/pytest-27/test_tom l_invalid_argument_typ0/test-home/functional2 configfile: pyproject.toml collected 0 items / 1 error ==================================== ERRORS ==================================== ______________________ ERROR collecting lang/test_lang.py ______________________ ImportError while importing test module '/private/var/folders/tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/p ytest-of-jade/pytest-27/test_toml_invalid_argument_typ0/test-home/functional2/lang/test_lang.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /nix/store/v0vy1c59f0vf71h64caw17hzymvg0zms-python3-3.12.10/lib/python3.12/importlib/__init__.py:90 : in import_module return _bootstrap._gcd_import(name[level:], package, level) lang/test_lang.py:7: in <module> import yaml E ModuleNotFoundError: No module named 'yaml' =========================== short test summary info ============================ ERROR lang/test_lang.py !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!! =============================== 1 error in 0.04s =============================== 2025-08-17T18:12:04Z [ ERROR] [functional2.testlib.fixtures.command] stderr: FAILED [100%] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> captured log >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ERROR functional2.testlib.fixtures.command:command.py:45 stdout: ============================= t est session starts ============================== platform darwin -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0 rootdir: /private/var/folders/tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/pytest-of-jade/pytest-27/test_tom l_invalid_argument_typ0/test-home/functional2 configfile: pyproject.toml collected 0 items / 1 error ==================================== ERRORS ==================================== ______________________ ERROR collecting lang/test_lang.py ______________________ ImportError while importing test module '/private/var/folders/tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/p ytest-of-jade/pytest-27/test_toml_invalid_argument_typ0/test-home/functional2/lang/test_lang.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /nix/store/v0vy1c59f0vf71h64caw17hzymvg0zms-python3-3.12.10/lib/python3.12/importlib/__init__.py:90 : in import_module return _bootstrap._gcd_import(name[level:], package, level) lang/test_lang.py:7: in <module> import yaml E ModuleNotFoundError: No module named 'yaml' =========================== short test summary info ============================ ERROR lang/test_lang.py !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!! =============================== 1 error in 0.04s =============================== ERROR functional2.testlib.fixtures.command:command.py:46 stderr: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> pytest_command = Command(argv=['pytest', '--basetemp', '../pytest_files', '-k', 'toml_test'], _env= <functional2.testlib.fixtures.env.Ma.../test_toml_invalid_argument_typ0/test-home/functional2'), _l ogger=<Logger functional2.testlib.fixtures.command (INFO)>) @pytest.mark.parametrize( ("files", "pytest_command"), [ ( get_functional2_lang_files( { "functional2": { "lang": { "toml_test": { "in.nix": File("{}"), "my_name.out.exp": File("{ }\n"), "test.toml": File( dedent(""" invalid_test = "eval-okay" [[test]] name = "my_name" runner = "eval-okay" flags = 1 [[test]] name = "second" runner = "eval-okay" extra-files = [false, true, true] """) ), } } } } ), ["-k", "toml_test"], ) ], indirect=True, ) @pytest.mark.usefixtures("files") def test_toml_invalid_argument_types(pytest_command: Command): > result = pytest_command.run().expect(1) E subprocess.CalledProcessError: Command '['pytest', '--basetemp', '../pytest_files', '-k', ' toml_test']' returned non-zero exit status 2. lang/test_lang_infra.py:438: CalledProcessError >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>> > /Users/jade/lix/lix/tests/functional2/lang/test_lang_infra.py(438)test_toml_invalid_argument_type s() -> result = pytest_command.run().expect(1) (Pdb) p pytest_command Command(argv=['pytest', '--basetemp', '../pytest_files', '-k', 'toml_test'], _env=<functional2.test lib.fixtures.env.ManagedEnv object at 0x106aee930>, stdin=None, cwd=PosixPath('/private/var/folders /tj/rq54rkrx5655xyqhz6ljq2x80000gn/T/pytest-of-jade/pytest-27/test_toml_invalid_argument_typ0/test- home/functional2'), _logger=<Logger functional2.testlib.fixtures.command (INFO)>) (Pdb) p pytest_command._env._env {'GIT_CONFIG_SYSTEM': '/dev/null', 'SHELL': '/bin/sh', 'PAGER': 'cat', 'BUILD_TEST_SHELL': '/bin', '_NIX_TEST_NO_SANDBOX': '1'} (Pdb) p pytest_command.path *** AttributeError: 'Command' object has no attribute 'path' (Pdb) p pytest_command._env.path _ManagedPath(_path=['/Users/jade/lix/lix/outputs/out/bin', 'None', '/nix/store/v0vy1c59f0vf71h64caw 17hzymvg0zms-python3-3.12.10/bin', '/nix/store/93znhry0ccspy50j4wq3jz93f73n2536-python3.12-pytest-8 .3.5/bin', '/nix/store/bc4kmk0axsjpqi2qb90prz48kgj9d3sh-pre-commit-4.0.1/bin', '/Users/jade/lix/lix /outputs/out/bin', '/nix/store/d12c7ny0s98iiycg0b2a4pdqn6fg97a2-clang-tools-19.1.7/bin', '/nix/stor e/g2r737j05jgy19c2yqnyvs71w8bxk4b1-bash-interactive-5.2p37/bin', '/nix/store/441zf0mh2603k3a9jqq2va iv92d4iaix-check-syscalls/bin', '/nix/store/lwnzwp8382fqp3m28c5h9a0d7643qbhz-python3-3.12.10-env/bi n', '/nix/store/j5fnid539kpg5dvnl2gpcibin39x558j-skopeo-1.18.0/bin', '/nix/store/4w4jqx6b693n45qfmw iwn8qd58f08rgf-just-1.40.0/bin', '/nix/store/r1630if1xipdb4bzyibs8pb6g134laz5-nixfmt-unstable-2025- 04-04/bin', '/nix/store/2jrzw9y1f1ar6mc1hp4mcyqxr5j70bvp-doxygen-1.13.2/bin', '/nix/store/cvhbqa01i 5yy7xmmpqp1hbnvq7kpvgsx-clang-wrapper-19.1.7/bin', '/nix/store/5hgabdyqh22l57cb3qgx10lcc40d5n9p-cla ng-19.1.7/bin', '/nix/store/d72z8b7fvvcin2p84x7h5s0abkggplzc-coreutils-9.7/bin', '/nix/store/k8q0n8 py04l07glgsfmvqqyqazxf04mb-cctools-binutils-darwin-wrapper-1010.6/bin', '/nix/store/idmz24ps83r9mz2 hkxdqwv6y4v2v7x28-cctools-binutils-darwin-1010.6/bin', '/nix/store/77dvdfdk9jhxd9bqn6k3djfbkas3i4fv -clang-19.1.7-python/bin', '/nix/store/33kilxl6fnq2m5aqn61h4nrjr4v344xp-rust-analyzer-2025-05-12/bi n', '/nix/store/v9kavzgzbym8adb6p7nxgid13jz76411-cargo-1.86.0/bin', '/nix/store/sg9421abrr6af5kcg50 gvyhlf11syhwv-rustc-wrapper-1.86.0/bin', '/nix/store/jgvccf4zr25v51ycxcplqrsfczixw3k5-rustfmt-1.86. 0/bin', '/nix/store/wbr8r10v6bi3xp1lc90ggf5n15s84y4m-llvm-19.1.7-dev/bin', '/nix/store/nh9z6y7agx6w 2lb72bvhwk1rlzp421n2-ncurses-6.5-dev/bin', '/nix/store/3578d0cacv8qb9mfp8na803svifqllrg-ncurses-6.5 /bin', '/nix/store/7ha8dv15lg62lcf9a6srnn58bcznnxbp-llvm-19.1.7/bin', '/nix/store/lzd8zgiggx9bkz5xc b8k8rhvrcp7hiia-clang-19.1.7-dev/bin', '/nix/store/b7fp4z37adfq52dwzx1y54kdb5p9nwgz-python3.12-yq-3 .4.3/bin', '/nix/store/z6i95qv7cmz12wk2sbj9xblx9mm0mnwx-python3.12-argcomplete-3.5.3/bin', '/nix/st ore/wy99fld1cyvkxb27p1piff1afhl8bgb0-python3.12-pre-commit-hooks-5.0.0/bin', '/nix/store/glv5r924n2 7cfwvzg3nskn8f3nqkwyrl-check-headers/bin', '/nix/store/y1h1992zyql0j53zq79mjxyhjam77qya-keep-sorted -0.6.1/bin', '/nix/store/gp6apqj9rk421amj1idy4k37mx2j0adq-build-release-notes/bin', '/nix/store/8ls v8mivnz7v3g98ilmfgps1gqviwhbv-treefmt/bin', '/nix/store/av7xsvkkf8h95g4041gf9vngwdwi5ybz-ruff-0.11. 10/bin', '/nix/store/cr8vgkja09m6fa5zn4v4xk5j7c1plgpy-clangbuildanalyzer-1.6.0/bin', '/nix/store/60 zw3h820l4k9pkzkhah47n26wj2ax3s-python3-3.12.10-env/bin', '/nix/store/5c7aacwalmwhq729byng6nlycva8qn sf-meson-1.7.2/bin', '/nix/store/7xl5lynglh18jmk6s44q5win7n496yy4-ninja-1.12.1/bin', '/nix/store/44 6sv4sjjz03j7zw44icjbd81mfl8inx-cmake-3.31.6/bin', '/nix/store/qxms5w7hisdjd1l2pkvlk46fwwxk50v9-capn proto-1.0.2/bin', '/nix/store/bx0b6gvphv01s2px3j1h1ajy036h8bgb-openssl-3.4.1-bin/bin', '/nix/store/ scff6xcwkhv6k09lxmkvapiiyj00mm8g-remove-references-to/bin', '/nix/store/23f5mz6zv5f4ld9ldpa32n6ammq h9y4y-lowdown-unsandboxed-2.0.2/bin', '/nix/store/p6wzqya0w0z3vspkm8yyhpjv0da6fjn8-mdbook-0.4.49/bi n', '/nix/store/b4y6nqivdfmr51jzfi21lgw98ai0gw42-mdbook-linkcheck-0.7.7/bin', '/nix/store/svafyjg9c ly5zrq6hvbd34d14szvx2l7-pkg-config-wrapper-0.29.2/bin', '/nix/store/9pa6rygnkrdp03j4ba0w6yb5qid5x3q b-git-2.49.0/bin', '/nix/store/izc36rp8i8rq5k1s3vm6xyyx7zs82425-mercurial-6.9.4/bin', '/nix/store/5 v1yqacl2lhgbrzgvbmnxbxah9pdyp2s-jq-1.7.1-bin/bin', '/nix/store/1ss2s2r7926y20i3f7h4ranri5r33qdk-lso f-4.99.4/bin', '/nix/store/9y6b0s0z24zvc9mh4khzvk2f83n1ywjw-xcbuild-0.1.1-unstable-2019-11-20-xcrun /bin', '/nix/store/hh6z6aagackr90b8148gmnzjch5x56h7-curl-8.13.0-dev/bin', '/nix/store/s9r15d8n23lk9 w6gbxa7m2n2pqqkjmsp-brotli-1.1.0/bin', '/nix/store/hw9ilqiiz2bc2k5hixql6x4bsbgms45y-krb5-1.21.3-dev /bin', '/nix/store/a80mhqjpxk2sbmkasy94sdhmwcx4nsbl-krb5-1.21.3-lib/bin', '/nix/store/kys6dn2w4j6vf 45fiwp6r330w6yvzk3z-krb5-1.21.3/bin', '/nix/store/scyl00wx4xj1aghfw30r7f29dcdhk62b-nghttp2-1.65.0/b in', '/nix/store/1hmsqq5nb15f8r2cxgc7pr64sh2xavqf-libidn2-2.3.8-bin/bin', '/nix/store/cwvaqj2nzi9ia l9xil3hh0695q27wvdf-libpsl-0.21.5/bin', '/nix/store/qh89f5cm8fzy6wbk55wiinbds78v637d-zstd-1.5.7-bin /bin', '/nix/store/bh18spw9agz58x6sycrkpr4piam7jb1d-zstd-1.5.7/bin', '/nix/store/j9l00pb7vjqichx1pb 9wh44mmpmsy5i8-curl-8.13.0-bin/bin', '/nix/store/7dvq6aba13kqkvj7ay850s4q806p33vw-bzip2-1.0.8-bin/b in', '/nix/store/rmn4csq2fk0scys2d0v6hgkd3yv5fkxj-xz-5.8.1-bin/bin', '/nix/store/cq20rd1ci51s72zv7k 29h63clrj6rl0l-sqlite-3.48.0-bin/bin', '/nix/store/bcnx80h4bsb3bq91bq8q4k9f18s9kbga-libarchive-3.7. 8/bin', '/nix/store/6a3jg9bqj5hdjylvasq4ildgxhd26035-lowdown-2.0.2/bin', '/nix/store/fhza62gkyw0mp1 h2zls6pl1832zjjf26-libiconv-109/bin', '/nix/store/d72z8b7fvvcin2p84x7h5s0abkggplzc-coreutils-9.7/bi n', '/nix/store/9gfvy5dd2kp4xf7m3k5gm79dx1mja2lj-findutils-4.10.0/bin', '/nix/store/wkgmvs8kl4a0xkr 1a1cs9m3hkn07zh5f-diffutils-3.12/bin', '/nix/store/3p81h24g11jfcdd7ifql71lr5mjag102-gnused-4.9/bin' , '/nix/store/6rdq4hg48bmqy7d8da38niai5ngg1x1s-gnugrep-3.11/bin', '/nix/store/ip1m0zq8r95z6wbhk6l0k 32anw8h4kc7-gawk-5.3.2/bin', '/nix/store/0pfs35y6gzcd3bxiybl7vih5yfyv8bcl-gnutar-1.35/bin', '/nix/s tore/29p1y63i1dxqspyrfima6s5ay6525zlf-gzip-1.14/bin', '/nix/store/7dvq6aba13kqkvj7ay850s4q806p33vw- bzip2-1.0.8-bin/bin', '/nix/store/wkq7f52a2xq4n24f545wy2fidm4z14f2-gnumake-4.4.1/bin', '/nix/store/ 8ivrpmp3arvxbr6imdwm2d28q9cjsqvi-bash-5.2p37/bin', '/nix/store/n1i5qvy1jcblq3s1ilnmc83yqcl0l8vk-pat ch-2.7.6/bin', '/nix/store/rmn4csq2fk0scys2d0v6hgkd3yv5fkxj-xz-5.8.1-bin/bin', '/nix/store/bpibjj5f 5z5p73afivj0ljzbpdgnjbi0-file-5.46/bin', '/Users/jade/lix/lix/.direnv/bin', '/Users/jade/.nix-profi le/bin', '/nix/var/nix/profiles/default/bin', '/Users/jade/.nix-profile/bin', '/Users/jade/bin', '/ Users/jade/.local/bin', '/usr/local/bin', '/usr/local/sbin', '/usr/bin', '/bin', '/usr/sbin', '/sbi n', '/Applications/iTerm.app/Contents/Resources/utilities', '/Users/jade/esp/xtensa-esp32-elf/bin', '/Users/jade/.npm-packages/bin', '/Users/jade/.cargo/bin']) (Pdb) ===================================== short test summary info ===================================== FAILED lang/test_lang_infra.py::test_toml_invalid_argument_types[files0-pytest_command0] - subproce ss.CalledProcessError: Command '['pytest', '--basetemp', '../pytest_files', '-k', 'tom... !!!!!!!!!!!!!!!!!!!!!!!!!!!! _pytest.outcomes.Exit: Quitting debugger !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ========================== 1 failed, 265 deselected in 71.21s (0:01:11) =========================== tests/functional2 » which pytest /nix/store/lwnzwp8382fqp3m28c5h9a0d7643qbhz-python3-3.12.10-env/bin/pytest ``` Basically it seems like the pytest being used recursively is not the same pytest as the one that's being used not-recursively. This is probably because the pytest being invoked not-recursively is putting a bad pytest into the head of PATH. cc @helle.
jade added this to the functional2 project 2025-08-17 16:28:13 +00:00
Author
Owner

repro, seems to happen on aarch64-linux too:

git clone ... lix
direnv allow
pytest tests/functional2 -k toml
repro, seems to happen on aarch64-linux too: ``` git clone ... lix direnv allow pytest tests/functional2 -k toml ```

can you provide the return value of shutil.which("pytest") within a python shell (base level)

can you provide the return value of `shutil.which("pytest")` within a python shell (base level)

also, how did it pass ci then?

also, how did it pass ci then?
Author
Owner

i am guessing it is some bullshit related to whether it's pytest from a python env vs pytest from a pile of build inputs. but not sure! let me get you that.

i am guessing it is some bullshit related to whether it's pytest from a python env vs pytest from a pile of build inputs. but not sure! let me get you that.
Author
Owner
lix/lix » python                                                                                                                                                                               thinnernix  HEAD
Python 3.12.10 (main, Apr  8 2025, 11:35:47) [GCC 14.2.1 20250322] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.which("pytest")
'/nix/store/cd1q3zm1hhx1yqd9snid0pcqvkmr30mi-python3-3.12.10-env/bin/pytest'

compare:

tests/functional2/lang/test_lang_infra.py:71: CalledProcessError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/jade/lix/lix/tests/functional2/lang/test_lang_infra.py(71)test_detects_toml_lang_test()
-> result = pytest_command.run().ok()
(Pdb) import shutil
(Pdb) shutil.which('pytest')
'/nix/store/a3q88rdni6kr08d2kqb9sy3zwrhyjy2a-python3.12-pytest-8.3.5/bin/pytest'
``` lix/lix » python thinnernix HEAD Python 3.12.10 (main, Apr 8 2025, 11:35:47) [GCC 14.2.1 20250322] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import shutil >>> shutil.which("pytest") '/nix/store/cd1q3zm1hhx1yqd9snid0pcqvkmr30mi-python3-3.12.10-env/bin/pytest' ``` compare: ``` tests/functional2/lang/test_lang_infra.py:71: CalledProcessError >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > /home/jade/lix/lix/tests/functional2/lang/test_lang_infra.py(71)test_detects_toml_lang_test() -> result = pytest_command.run().ok() (Pdb) import shutil (Pdb) shutil.which('pytest') '/nix/store/a3q88rdni6kr08d2kqb9sy3zwrhyjy2a-python3.12-pytest-8.3.5/bin/pytest' ```
Author
Owner

This is an identical issue upstream as https://github.com/NixOS/nixpkgs/issues/248978

This is an identical issue upstream as https://github.com/NixOS/nixpkgs/issues/248978
Author
Owner
diff --git a/package.nix b/package.nix
index cb393c1148..eaea7c8ce0 100644
--- a/package.nix
+++ b/package.nix
@@ -141,6 +141,8 @@
   # This is for sys/sdt.h
   dtrace-headers = if withDtrace then libsystemtap else null;
 
+  dontWrapPython = drv: drv.overridePythonAttrs (old: { dontWrapPythonPrograms = true; });
+
   aws-sdk-cpp-nix =
     if aws-sdk-cpp == null then
       null
@@ -212,7 +214,7 @@
       p.pycapnp
     ]
     ++ lib.optionals finalAttrs.doCheck [
-      p.pytest
+      (dontWrapPython p.pytest)
       p.pytest-xdist
       p.ruff
       p.aiohttp
@@ -528,7 +530,7 @@
           p: [
             # FIXME: these have to be added twice due to the nix shell using a
             # wrapped python instead of build inputs for its python inputs
-            p.pytest
+            (dontWrapPython p.pytest)
             p.pytest-xdist
             p.ruff
             p.aiohttp

lol, okay, this just fixes it. i wonder why we default to breaking python programs.

``` diff --git a/package.nix b/package.nix index cb393c1148..eaea7c8ce0 100644 --- a/package.nix +++ b/package.nix @@ -141,6 +141,8 @@ # This is for sys/sdt.h dtrace-headers = if withDtrace then libsystemtap else null; + dontWrapPython = drv: drv.overridePythonAttrs (old: { dontWrapPythonPrograms = true; }); + aws-sdk-cpp-nix = if aws-sdk-cpp == null then null @@ -212,7 +214,7 @@ p.pycapnp ] ++ lib.optionals finalAttrs.doCheck [ - p.pytest + (dontWrapPython p.pytest) p.pytest-xdist p.ruff p.aiohttp @@ -528,7 +530,7 @@ p: [ # FIXME: these have to be added twice due to the nix shell using a # wrapped python instead of build inputs for its python inputs - p.pytest + (dontWrapPython p.pytest) p.pytest-xdist p.ruff p.aiohttp ``` lol, okay, this just fixes it. i wonder why we default to breaking python programs.
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/4044 ("package: fix running pytest in a dev shell")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/4044", "number": 4044, "kind": "commit message"}], "cl_meta": {"4044": {"change_title": "package: fix running pytest in a dev shell"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/4044](https://gerrit.lix.systems/c/lix/+/4044) ("package: fix running pytest in a dev shell")
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#964
No description provided.