cool-easter-32542
07/11/2025, 11:30 PMpants --keep-sandboxes=always test projects/test_foo.py:tests -- -l
16:25:31.92 [INFO] Preserving local process execution dir /Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk for Run Pytest for projects/test_foo.py:tests
16:25:35.94 [INFO] Completed: Scheduling: Run Pytest for projects/test_foo.py:tests
16:25:35.94 [ERROR] Completed: Run Pytest - projects/test_foo.py:tests - failed (exit code 1).
============================= test session starts ==============================
platform darwin -- Python 3.11.11, pytest-7.4.4, pluggy-1.6.0
rootdir: /Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk
configfile: pytest.ini
plugins: asyncio-0.23.8, docker-3.2.3, xdist-3.7.0, cov-6.2.1, mock-3.14.1, opentelemetry-1.1.0, hypothesis-6.127.9
asyncio: mode=Mode.AUTO
collected 1 item
projects/test_foo.py F [100%]
=================================== FAILURES ===================================
___________________________________ test_foo ___________________________________
def test_foo():
print(os.getcwd())
extra = f"{os.getcwd()}/extra"
print(extra)
assert os.getcwd() in extra
> assert False, "this was actually successful"
E AssertionError: this was actually successful
E assert False
extra = '/Users/jordan/git/pants.dextra'
projects/test_foo.py:8: AssertionError
----------------------------- Captured stdout call -----------------------------
/Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk
/Users/jordan/git/pants.dextra
- generated xml file: /Users/jordan/git/pants.dprojects.test_foo.py.tests.xml -
=========================== short test summary info ============================
FAILED projects/test_foo.py::test_foo - AssertionError: this was actually successful
============================== 1 failed in 0.13s ===============================
✕ projects/test_foo.py:tests failed in 3.92s.
Note that:
• /tmp/pants-sandbox-4DThMk is successfully printed in the terminal output: the first line in the capture output is /Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk
• /tmp/pants-sandbox-4DThMk/ is stripped from everywhere it should appear: the second line in the capture output is /Users/jordan/git/pants.dextra, which is not a real path.
When re-running the __run.sh script in the sandbox, all the terminal output is correct:
/Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk/__run.sh
================================================= test session starts ==================================================
platform darwin -- Python 3.11.11, pytest-7.4.4, pluggy-1.6.0
rootdir: /Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk
configfile: pytest.ini
plugins: asyncio-0.23.8, docker-3.2.3, xdist-3.7.0, cov-6.2.1, mock-3.14.1, opentelemetry-1.1.0, hypothesis-6.127.9
asyncio: mode=Mode.AUTO
collected 1 item
projects/test_foo.py F [100%]
======================================================= FAILURES =======================================================
_______________________________________________________ test_foo _______________________________________________________
def test_foo():
print(os.getcwd())
extra = f"{os.getcwd()}/extra"
print(extra)
assert os.getcwd() in extra
> assert False, "this was actually successful"
E AssertionError: this was actually successful
E assert False
extra = '/Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk/extra'
projects/test_foo.py:8: AssertionError
------------------------------------------------- Captured stdout call -------------------------------------------------
/Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk
/Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk/extra
--- generated xml file: /Users/jordan/git/pants.d/tmp/pants-sandbox-4DThMk/projects.test_foo.py.tests.xml ----
=============================================== short test summary info ================================================
FAILED projects/test_foo.py::test_foo - AssertionError: this was actually successful
================================================== 1 failed in 0.05s ===================================================
pantsbuild/pants