Archived
22 lines
851 B
Python
22 lines
851 B
Python
"""The bootstrap runs the local installer and never downloads upstream code."""
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def test_bootstrap_uses_local_source(tmp_path):
|
|
bash = shutil.which('bash')
|
|
if not bash:
|
|
pytest.skip('bash is required')
|
|
source = tmp_path / 'source'
|
|
(source / 'scripts').mkdir(parents=True)
|
|
shutil.copyfile(ROOT / 'install.sh', source / 'install.sh')
|
|
(source / 'scripts' / 'install.sh').write_text('#!/bin/sh\nprintf "local installer: %s" "$1"\n', encoding='utf-8')
|
|
result = subprocess.run([bash, str(source / 'install.sh'), 'test'], capture_output=True, text=True, check=True)
|
|
assert result.stdout == 'local installer: test'
|
|
assert 'KindMich/WGTools' not in (ROOT / 'install.sh').read_text(encoding='utf-8')
|