personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test: per-run --basetemp so concurrent worktrees don't share pytest tmp

The existing TMPDIR=/var/tmp comment claimed pytest's default per-run
isolation prevented collisions, but multiple worktrees running pytest
concurrently still share /var/tmp/pytest-of-$USER/pytest-N/ — pytest wipes
the basetemp on startup, deleting in-flight tmp_path dirs from sibling
runs and producing FileNotFoundError storms. Add a unique --basetemp
(mktemp -d) to every top-level Makefile pytest invocation, and pass an
explicit --basetemp to the nested pytest canary in test_tmpdir_fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+28 -13
+15 -12
Makefile
··· 2 2 # Python-based AI-driven desktop journaling toolkit 3 3 4 4 # Route pytest tmp dirs to /var/tmp (disk) instead of default /tmp (tmpfs/RAM). 5 - # Combined with pytest's default per-run isolation (/var/tmp/pytest-of-$USER/pytest-N/), 6 - # concurrent test runs don't collide. Do not re-add --basetemp to pyproject — it pins 7 - # all runs to one path and pytest wipes it on startup, destroying concurrent state. 5 + # Each top-level pytest invocation also gets a unique --basetemp so concurrent 6 + # runs in different worktrees do not share /var/tmp/pytest-of-$USER/pytest-N/. 7 + # Do not re-add --basetemp to pyproject — it would pin all runs to one path and 8 + # pytest wipes it on startup, destroying concurrent state. 8 9 export TMPDIR := /var/tmp 10 + PYTEST_BASETEMP := $(shell mktemp -d /var/tmp/solstone-pytest-XXXXXX) 11 + PYTEST_BASETEMP_FLAG := --basetemp $(PYTEST_BASETEMP) 9 12 10 13 .PHONY: install uninstall test test-apps test-app test-only test-integration test-integration-only test-all format format-check install-checks ci clean clean-install coverage watch versions update update-prices pre-commit skills dev all sandbox sandbox-stop install-pinchtab install-models parakeet-helper parakeet-helper-clean verify-browser update-browser-baselines review verify verify-api update-api-baselines install-service uninstall-service service-logs gate-agents-rename check-layer-hygiene doctor FORCE 11 14 ··· 368 371 # Run core tests (excluding integration and app tests) 369 372 test: .installed format-check 370 373 @echo "Running core tests..." 371 - $(TEST_ENV) $(PYTEST) tests/ -q --cov=. --ignore=tests/integration $(LINK_LIVE_TESTS) 374 + $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/ -q --cov=. --ignore=tests/integration $(LINK_LIVE_TESTS) 372 375 373 376 # Run app tests 374 377 test-apps: .installed 375 378 @echo "Running app tests..." 376 - $(TEST_ENV) $(PYTEST) apps/ -q 379 + $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/ -q 377 380 378 381 # Run specific app tests 379 382 test-app: .installed ··· 382 385 echo "Example: make test-app APP=todos"; \ 383 386 exit 1; \ 384 387 fi 385 - $(TEST_ENV) $(PYTEST) apps/$(APP)/tests/ -v 388 + $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/$(APP)/tests/ -v 386 389 387 390 # Run specific test file or pattern 388 391 test-only: .installed ··· 392 395 echo "Example: make test-only TEST=\"-k test_function_name\""; \ 393 396 exit 1; \ 394 397 fi 395 - $(TEST_ENV) $(PYTEST) $(TEST) 398 + $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) $(TEST) 396 399 397 400 # Run integration tests 398 401 test-integration: .installed 399 402 @echo "Running integration tests..." 400 403 @STATUS=0; \ 401 - $(TEST_ENV) $(PYTEST) tests/integration/ tests/link/test_integration.py tests/link/test_privacy_scan.py -v --tb=short --timeout=20 || STATUS=$$?; \ 404 + $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/integration/ tests/link/test_integration.py tests/link/test_privacy_scan.py -v --tb=short --timeout=20 || STATUS=$$?; \ 402 405 if [ "$$STATUS" -ne 0 ] && [ "$$STATUS" -ne 5 ]; then exit $$STATUS; fi 403 406 404 407 # Run specific integration test ··· 414 417 *) TARGET="tests/integration/$$TARGET" ;; \ 415 418 esac; \ 416 419 STATUS=0; \ 417 - $(TEST_ENV) $(PYTEST) "$$TARGET" --timeout=20 || STATUS=$$?; \ 420 + $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) "$$TARGET" --timeout=20 || STATUS=$$?; \ 418 421 if [ "$$STATUS" -ne 0 ] && [ "$$STATUS" -ne 5 ]; then exit $$STATUS; fi 419 422 420 423 # Run all tests (core + apps + integration) 421 424 test-all: .installed 422 425 @echo "Running all tests (core + apps + integration)..." 423 - $(TEST_ENV) $(PYTEST) tests/ -v --cov=. --ignore=tests/integration $(LINK_LIVE_TESTS) && $(TEST_ENV) $(PYTEST) apps/ -v --cov=. --cov-append 426 + $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/ -v --cov=. --ignore=tests/integration $(LINK_LIVE_TESTS) && $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/ -v --cov=. --cov-append 424 427 425 428 # Auto-format and fix code, then report any remaining issues 426 429 format: .installed ··· 590 593 591 594 # Generate coverage report (core + apps, excluding core integration tests) 592 595 coverage: .installed 593 - $(TEST_ENV) $(PYTEST) tests/ --cov=. --cov-report=html --cov-report=term --ignore=tests/integration $(LINK_LIVE_TESTS) 594 - $(TEST_ENV) $(PYTEST) apps/ --cov=. --cov-report=html --cov-report=term --cov-append 596 + $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) tests/ --cov=. --cov-report=html --cov-report=term --ignore=tests/integration $(LINK_LIVE_TESTS) 597 + $(TEST_ENV) $(PYTEST) $(PYTEST_BASETEMP_FLAG) apps/ --cov=. --cov-report=html --cov-report=term --cov-append 595 598 @echo "Coverage report generated in htmlcov/index.html" 596 599 597 600 # Update all dependencies to latest versions and refresh genai-prices
+13 -1
tests/test_tmpdir_fallback.py
··· 28 28 pytester: pytest.Pytester, 29 29 env_overrides: dict[str, str | None] | None = None, 30 30 ) -> subprocess.CompletedProcess[str]: 31 + basetemp = pytester.path / "basetemp" 31 32 env = os.environ.copy() 32 33 env.pop("TMPDIR", None) 33 34 env.pop("_SOLSTONE_TMPDIR_FALLBACK_NOTIFIED", None) ··· 39 40 else: 40 41 env[key] = value 41 42 return subprocess.run( 42 - [sys.executable, "-m", "pytest", "-q", "-p", "no:cacheprovider"], 43 + [ 44 + sys.executable, 45 + "-m", 46 + "pytest", 47 + "-q", 48 + "-p", 49 + "no:cacheprovider", 50 + "--basetemp", 51 + str(basetemp), 52 + ], 43 53 cwd=pytester.path, 44 54 env=env, 45 55 capture_output=True, ··· 180 190 "-q", 181 191 "-p", 182 192 "no:cacheprovider", 193 + "--basetemp", 194 + str(pytester.path / "basetemp"), 183 195 str(test_path), 184 196 ], 185 197 cwd=pytester.path,