-
-
Notifications
You must be signed in to change notification settings - Fork 515
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
Test that the Sage git repo is clean. #39392
base: develop
Are you sure you want to change the base?
Conversation
Documentation preview for this PR (built with commit d8dc279; changes) is ready! 🎉 |
I'm tempted to make this a blocker. |
I'm not sure this is an appropriate test to have among "normal" Sage tests. While it might be useful for CI, in development one often runs tests with uncommitted changes. |
By the way, did you see #39363 ? |
Maybe it's okay to be reminded in such situations that there are uncommitted changes. We have recently had at least two cases with beta releases where the git repo was left in a non-clean state. It is apparently not on the release manager's radar to check this, and some developers don't seem to check it either. How else might we implement such a test? |
+1 to adding a test. I'm fine with it being part of the doctests, though that means it runs somewhere in the middle of all tests Alternative would be to use a make target like
and run it at the end of the
|
yes, this sounds like a better idea. As well, it would be great to actually list such files, as this may happen at CI's runs. |
Yes, that looks good, and it's a great point about making sure this runs after all of the other tests. Two comments:
diff --git a/Makefile b/Makefile
index 9990af924c..58d139a341 100644
--- a/Makefile
+++ b/Makefile
@@ -253,9 +253,20 @@ TEST_TARGET = $@
TEST = ./sage -t --logfile=$(TEST_LOG) $(TEST_FLAGS) --optional=$(TEST_OPTIONAL) $(TEST_FILES)
+.PHONY: test-git-no-uncommitted-changes
+test-git-no-uncommitted-changes:
+ @UNCOMMITTED=$$(git status --porcelain); \
+ if [ -n "$$UNCOMMITTED" ]; then \
+ echo "git repo has uncommitted changes"; \
+ echo "$$UNCOMMITTED"; \
+ echo; \
+ exit 1; \
+ fi
+
test: all
@echo '### make $(TEST_TARGET): Running $(TEST)' >> $(TEST_LOG)
$(TEST)
+ $(MAKE) test-git-no-uncommitted-changes
check:
@$(MAKE) test |
Oh, and I think I need to change the lines
to
to make sure both lines get executed; otherwise, if there are doctest failures, it bails out before running the last line. (And I regularly get doctest failures on OS X, and I want this change to be helpful even when that happens.) |
Okay, here's a branch with the changes to |
Test that the Sage git repo is clean <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Add a doctest which will check whether the Sage git repo is clean. The test is based on the top answer at https://unix.stackexchange.com/questions/155046/determine-if-git- working-directory-is-clean-from-a-script. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39392 Reported by: John H. Palmieri Reviewer(s):
Test that the Sage git repo is clean
Add a doctest which will check whether the Sage git repo is clean. The test is based on the top answer at https://unix.stackexchange.com/questions/155046/determine-if-git-working-directory-is-clean-from-a-script.
📝 Checklist
⌛ Dependencies