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
pytest is eating the middle of stdout in tracebacks #1745
Comments
Thanks for the issue. I tried to (artificially) reproduce this with: diff --git a/tools/osbuild-depsolve-dnf b/tools/osbuild-depsolve-dnf
index adfc4040..79d65e01 100755
--- a/tools/osbuild-depsolve-dnf
+++ b/tools/osbuild-depsolve-dnf
@@ -62,6 +62,9 @@ class Solver():
self.base.conf.persistdir = persistdir
self.base.conf.cachedir = cache_dir
self.base.conf.substitutions['arch'] = arch
+ for i in range(1000):
+ print(10*f"{i}", file=sys.stderr)
+ xxx
self.base.conf.substitutions['basearch'] = dnf.rpm.basearch(arch)
self.base.conf.substitutions['releasever'] = releasever
if proxy: and get the full output of stderr via:
But then I noticed that this already includes f892351 so I reverted that and now I can see:
which I assume is what you also see? This is set in https://github.com/pytest-dev/pytest/blob/main/src/_pytest/_io/saferepr.py#L95 and afaict there is no way to override this for this level, it is called from https://github.com/pytest-dev/pytest/blob/8.1.x/src/_pytest/_code/code.py#L841 without an maxsize. It seems there is/as some discussion in pytest-dev/pytest#11387 but nothing concrete. Wiring this up shouldn't be too hard, something like Which is slightly sad. |
That's similar, but it is in stdout, not stderr. To reproduce it edit osbuild-depsolve-dnf5 to revert the diff --git a/tools/osbuild-depsolve-dnf5 b/tools/osbuild-depsolve-dnf5
index 64afd199..7b577318 100755
--- a/tools/osbuild-depsolve-dnf5
+++ b/tools/osbuild-depsolve-dnf5
@@ -105,7 +105,7 @@ class Solver():
transactions = arguments.get("transactions") or []
for t in transactions:
# Return an empty list when 'exclude-specs' key is missing or when it is None
- exclude_pkgs.extend(t.get("exclude-specs") or [])
+ exclude_pkgs.extend(t.get("exclude-specs", []))
if not exclude_pkgs:
exclude_pkgs = [] and then run pytest. I don't see a proper traceback at all, other than one from subprocess.CalledProcessError |
Thank @bcl ! That helped a lot, I can reproduce it now in the same way and most of what I wrote above is bogus (sorry!). I opened pytest-dev/pytest#12241 on pytest to see if they are open for a tweak here, with that patch I get:
which is more useful. |
At least I think it is pytest. I'm not 100% sure since I couldn't fix it.
When the tools/test/test_depsolve.py failed when running osbuild_depsolve_dnf5 it would print the contents of the subprocess variables, including stdout which includes a traceback (from osbuild_depsolve_dnf5) wrapped in json. The string is a bit long, and something is chopping out the middle and replacing it with '...'
If I manually trigger failures in the script the json wrapped traceback is fine.
If I run pytest tools manually it is missing the middle part, which ends up being the part telling you what line failed :)
I tried running pytest with
--tb=long
or--full-traceback
and didn't get any more of the output.So I'm currently stumped as to what's replacing that part of the string with
...
The text was updated successfully, but these errors were encountered: