Skip to content

Make Base tests ignore inherited runtime env#496

Merged
codeforester merged 1 commit into
masterfrom
fix/493-20260607-hermetic-base-setup-tests
Jun 7, 2026
Merged

Make Base tests ignore inherited runtime env#496
codeforester merged 1 commit into
masterfrom
fix/493-20260607-hermetic-base-setup-tests

Conversation

@codeforester
Copy link
Copy Markdown
Owner

Summary

  • Launch Base's full test runner with Base runtime and project environment variables removed before pytest and BATS start.
  • Clear inherited project runtime variables in the Python setup test harness and add a regression for dry-run artifact planning.
  • Make setup/check Homebrew Python lookups honor the resolved brew binary instead of leaking to host Homebrew, and make shell startup assertions tolerate optional sibling platform tools.

Root Cause

When basectl test base delegates to bin/base-test, it exports the resolved Base project runtime environment. The Python setup dry-run tests and BATS fixtures then inherited variables such as BASE_PROJECT_VENV_DIR, BASE_BIN_DIR, and optional platform-tools state. That made tests inspect the real Base venv or assert against host-specific PATH shapes instead of their isolated fixtures.

Validation

  • git diff --check
  • bash -n bin/base-test
  • bash -n cli/bash/commands/basectl/subcommands/setup_common.sh
  • env BASE_PROJECT=base BASE_PROJECT_ROOT=/Users/rameshhp/work/base BASE_PROJECT_MANIFEST=/Users/rameshhp/work/base/base_manifest.yaml BASE_PROJECT_VENV_DIR=/Users/rameshhp/.base.d/base/.venv PYTHONPATH=/Users/rameshhp/work/base/lib/python:/Users/rameshhp/work/base/cli/python /Users/rameshhp/.base.d/base/.venv/bin/python -m pytest cli/python/base_setup/tests/test_artifacts.py -q
  • env -u BASE_HOME -u BASE_BIN_DIR -u BASE_CLI_DIR -u BASE_BASH_DIR -u BASE_BASH_COMMANDS_DIR -u BASE_LIB_DIR -u BASE_BASH_LIB_DIR -u BASE_SHELL_DIR -u BASE_OS -u BASE_HOST -u BASE_SHELL -u BASE_PLATFORM_TOOLS_HOME -u BASE_PLATFORM_TOOLS_BIN_DIR -u BASE_PROFILE_VERSION -u BASE_ENABLE_BASH_DEFAULTS -u BASE_ENABLE_ZSH_DEFAULTS -u BASE_DEBUG -u BASE_BASH_COMMAND_NAME -u BASE_BASH_COMMAND_DIR -u BASE_BASH_COMMAND_SCRIPT -u BASE_BASH_BOOTSTRAP_SOURCE -u BASE_PROJECT -u BASE_PROJECT_ROOT -u BASE_PROJECT_MANIFEST -u BASE_PROJECT_VENV_DIR -u VIRTUAL_ENV bats cli/bash/commands/basectl/tests/check.bats cli/bash/commands/basectl/tests/runtime-shell.bats cli/bash/commands/basectl/tests/setup.bats cli/bash/commands/basectl/tests/update-profile.bats
  • /Users/rameshhp/work/base/bin/basectl test base

Closes #493

@codeforester codeforester merged commit 0a780d1 into master Jun 7, 2026
16 checks passed
@codeforester codeforester deleted the fix/493-20260607-hermetic-base-setup-tests branch June 7, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make base_setup Python artifact dry-run tests independent of inherited Base project venv

1 participant