Skip to content

Conversation

@antonio-rojas
Copy link
Contributor

So one can simply copy and paste the output to rerun the tests

@github-actions
Copy link

github-actions bot commented Sep 1, 2025

Documentation preview for this PR (built with commit 2236987; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 16, 2025
sagemathgh-40746: Print full relative path for sage-runtests
    
So one can simply copy and paste the output to rerun the tests
    
URL: sagemath#40746
Reported by: Antonio Rojas
Reviewer(s):
@vbraun
Copy link
Member

vbraun commented Sep 19, 2025

It does print the path

src/bin/sage-runtests --long --warn-long 30.0 --random-seed=0 src/sage/modular/abvar/torsion_subgroup.py  # 3 doctests failed

but when I try to paste it:

buildbot-sage@Mini-M2 build % ./src/bin/sage-runtests --long --warn-long 30.0 --random-seed=0 src/sage/modular/abvar/torsion_subgroup.py
Traceback (most recent call last):
  File "/Users/buildbot-sage/worker/sage_git/build/./src/bin/sage-runtests", line 5, in <module>
    from sage.doctest.__main__ import main
ModuleNotFoundError: No module named 'sage'

@antonio-rojas
Copy link
Contributor Author

Set back to use sage -t now

vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 22, 2025
sagemathgh-40746: Print full relative path for sage-runtests
    
So one can simply copy and paste the output to rerun the tests
    
URL: sagemath#40746
Reported by: Antonio Rojas
Reviewer(s):
@kwankyu
Copy link
Collaborator

kwankyu commented Sep 23, 2025

May I ask why it is not simply ./sage -t --long ... (without src/bin) instead of src/bin/sage -t --long?

@antonio-rojas
Copy link
Contributor Author

May I ask why it is not simply ./sage -t --long ... (without src/bin) instead of src/bin/sage -t --long?

Because we can't assume where you're running the tests from

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 23, 2025

Don't we assume at the sage root (root of the source repo)?

"./sage -t" does not work in conda/meson?

vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 24, 2025
sagemathgh-40746: Print full relative path for sage-runtests
    
So one can simply copy and paste the output to rerun the tests
    
URL: sagemath#40746
Reported by: Antonio Rojas
Reviewer(s):
@antonio-rojas
Copy link
Contributor Author

Don't we assume at the sage root (root of the source repo)?

Why should we? One can run test from anywhere by running

  1. sage -t in the sage source root
  2. sage -t in src/bin
  3. sage-runtests in src/bin
  4. sage -t from $PATH in a (non-meson) installation of sagelib

"./sage -t" does not work in conda/meson?

It does if you run it from the source dir, not from an installed (eg. distro packaged) sage.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 24, 2025

Don't we assume at the sage root (root of the source repo)?

Why should we?

I am not saying that we should. This PR prints it as src/bin/sage -t --long . Hence we are supposed to copy and paste the printed command when we are at the sage source root. Right? If so, then why not print it just as ./sage -t --long which is short and equally works at the sage source root. No?

One can run test from anywhere by running

  1. sage -t in the sage source root
  2. sage -t in src/bin
  3. sage-runtests in src/bin
  4. sage -t from $PATH in a (non-meson) installation of sagelib

Yes.

@antonio-rojas
Copy link
Contributor Author

antonio-rojas commented Sep 24, 2025

Don't we assume at the sage root (root of the source repo)?

Why should we?

I am not saying that we should. This PR prints it as src/bin/sage -t --long . Hence we are supposed to copy and paste the printed command when we are at the sage source root. Right? If so, then why not print it just as ./sage -t --long which is short and equally works at the sage source root. No?

Oh, I see. That's because there is no way (that I know of) of knowing which sage bash script you used to launch sage-runtests once you are in python code. IOW: sage can't tell apart 1) from 2) in the list above, it will always return sage-runtests for sys.argv[0] regardless of how you arrived there. Hence we print the one that lives in the same path as sage-runtests, which is always guaranteed to exist.

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 24, 2025

... Hence we print the one that lives in the same path as sage-runtests, which is always guaranteed to exist.

Of course,src/bin/sage should exist. But ./sage should also exist. No? One can even say ./sage is closer to the user than src/bin/sage.

The doctester used to print sage -t (https://github.com/sagemath/sage/actions/runs/16705032118/job/47281874408). Now seeing that src/bin/sage -t is printed, I wondered if there is a scenario that ./sage does not exist.

@antonio-rojas
Copy link
Contributor Author

... Hence we print the one that lives in the same path as sage-runtests, which is always guaranteed to exist.

Of course,src/bin/sage should exist. But ./sage should also exist. No? One can even say ./sage is closer to the user than src/bin/sage.

No, it need not exist if you don't have the sage source around (eg. you installed it from distro packages or pypi)

@kwankyu
Copy link
Collaborator

kwankyu commented Sep 24, 2025

I never imagined a situation that src/ directory exists but ./sage script does not exist, perhaps because I always work in the full sage source tree (cloned repo) when running doctests.

Okay. Thank you.

@vbraun vbraun merged commit ddfdc3e into sagemath:develop Sep 27, 2025
23 of 24 checks passed
@antonio-rojas antonio-rojas deleted the sage-runtests-fullpath branch September 27, 2025 19:43
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.

4 participants