Repository navigation
Local check noise: carddemo snapshot, crucible pin gate, stub-proof yaml import (#3386) #3399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
8d664c8
Local check noise: re-bless carddemo snapshot, fail on crucible pin d…
squid-protocol e52d9f1
test: import _crucible_pin one way only (CodeQL py/import-and-import-…
squid-protocol f1f5503
test: import _crucible_pin one way only (CodeQL py/import-and-import-…
squid-protocol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| """#3386: an off-pin language-crucible checkout fails with the exact fix command.""" | ||
|
|
||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| sys.path.insert(0, str(Path(__file__).parent)) | ||
| import _crucible_pin | ||
|
|
||
| ALLOW_UNPINNED_ENV = _crucible_pin.ALLOW_UNPINNED_ENV | ||
|
|
||
|
|
||
| def _git(repo, *args): | ||
| subprocess.run(["git", "-C", str(repo), *args], check=True, capture_output=True) | ||
|
|
||
|
|
||
| def _repo(tmp_path): | ||
| repo = tmp_path / "language-crucible" | ||
| repo.mkdir() | ||
| _git(repo, "init", "-q") | ||
| for msg in ("old", "pinned"): | ||
| _git(repo, "-c", "user.name=t", "-c", "user.email=t@t", "commit", "-q", "--allow-empty", "-m", msg) | ||
| _git(repo, "tag", "v0.0.1" if msg == "old" else _crucible_pin.PINNED_TAG) | ||
| return repo | ||
|
|
||
|
|
||
| def test_on_pin_passes(tmp_path, monkeypatch): | ||
| monkeypatch.delenv(ALLOW_UNPINNED_ENV, raising=False) | ||
| assert _crucible_pin.pin_mismatch(_repo(tmp_path)) is None | ||
|
|
||
|
|
||
| def test_off_pin_names_the_checkout_command(tmp_path, monkeypatch): | ||
| monkeypatch.delenv(ALLOW_UNPINNED_ENV, raising=False) | ||
| repo = _repo(tmp_path) | ||
| _git(repo, "checkout", "-q", "v0.0.1") | ||
| message = _crucible_pin.pin_mismatch(repo) | ||
| assert "v0.0.1" in message | ||
| assert f"git -C {repo} fetch --tags origin && git -C {repo} checkout {_crucible_pin.PINNED_TAG}" in message | ||
|
|
||
|
|
||
| def test_missing_pinned_tag_is_a_mismatch(tmp_path, monkeypatch): | ||
| monkeypatch.delenv(ALLOW_UNPINNED_ENV, raising=False) | ||
| repo = _repo(tmp_path) | ||
| monkeypatch.setattr(_crucible_pin, "PINNED_TAG", "v99.0.0") | ||
| assert "v99.0.0" in _crucible_pin.pin_mismatch(repo) | ||
|
|
||
|
|
||
| def test_escape_hatch_and_non_git_corpus_pass(tmp_path, monkeypatch): | ||
| repo = _repo(tmp_path) | ||
| _git(repo, "checkout", "-q", "v0.0.1") | ||
| monkeypatch.setenv(ALLOW_UNPINNED_ENV, "1") | ||
| assert _crucible_pin.pin_mismatch(repo) is None | ||
| monkeypatch.delenv(ALLOW_UNPINNED_ENV) | ||
| assert _crucible_pin.pin_mismatch(tmp_path / "unpacked-archive") is None | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.