-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
len(list) should be summarized in most cases #8
Comments
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): fix issue8 : avoid errors caused by logging module wanting to close already closed streams. The issue arose if logging was initialized while capturing was enabled |
Original comment by BitBucket: wtanksleyjr, GitHub: wtanksleyjr: What you fixed (cool, thanks!) doesn't sound like what I was asking about. (Is this the fix for my other bug report, for asserts in doctest? If so, that's great -- that's a MUCH more debilitating bug. Attached is a simple test that demonstrates my problem for this report. Notice how it's impossible to diagnose the failure from the printout; now imagine how hard it'd be to figure out if the code wasn't deliberately simple :-). I'm not changing the state of this issue, because I'm not sure how to test this (I used pip to install, I don't know how to force it to upgrade using bitbucket). |
Original comment by BitBucket: wtanksleyjr, GitHub: wtanksleyjr: I tested this using the attachment "test3.py" (attached when I wrote the above comment), and confirmed that it is not fixed. I've changed the issue to open, if you don't mind... |
Original comment by Floris Bruynooghe (BitBucket: flub, GitHub: flub): Hi I've had a look at this and it seems that the code actually goes out of it's way to hide the actual value the function evaluates for builtin functions as well as for functions which return a boolean. After applying the attached patch your test3.py shows as: {{{ test3.py F =================================== FAILURES ===================================
test3.py:3: AssertionError To me this seems like enough, what do others think? However since this was explicitly done and even mentioned in the comments I wonder if someone still knows what the reason was to do this? Regards |
Original comment by Anonymous: That looks quite sufficient to me. I can't speak for the author, though. |
Original comment by BitBucket: wtanksleyjr, GitHub: wtanksleyjr: I admit that old code looks like it knows what it's doing -- that's a long way to go in order to make things less convenient. I give up... I have no idea why this code is there. I only know that while it was there, I had to write and run a manual test (with prints). -Wm |
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): i think it makes sense to go for Floris patch. If no tests break and a new test passes, let's try it out and see if anything unexpected happens. (i don't currently know what the reason was TBH - the hack was introduced by Armin IIRC and it might actually have to do with PyPy interactions) |
Original comment by Floris Bruynooghe (BitBucket: flub, GitHub: flub): I've prepared the fix in the "len" patch on https://bitbucket.org/flub/py-queue All the tests for py as well as pytest pass with this patch applied and all seem to pass correctly (only tested with python2.6 so far). All the examples and failure demos seem to produce good output too. Any feedback on whether the added test and changelog are sufficient would be appreciated. |
Original comment by Floris Bruynooghe (BitBucket: flub, GitHub: flub): Committed in https://bitbucket.org/hpk42/py/changeset/71dfb239aa60 |
pytest 2.8 compatibility
Trailing commas after * or ** in a function signature are only safe for Python 3.6 code. So now Black checks whether the file was already Python 3.6 to begin with. If so, trailing commas are used in such cases. Otherwise, they're not. When * and ** don't appear in a function signature, the trailing comma is always safe. Fixes pytest-dev#8
Features/devpi server
Originally reported by: BitBucket: wtanksleyjr, GitHub: wtanksleyjr
I have some code which runs:
assert len(mylist) == 2 *** *** 10
When this fails, py.test prints out something like:
The problem is that it's impossible to tell exactly why the assert is failing -- the whole list can't reasonably be printed, and truncating the list loses the information that actually matters.
If a list inside a len is truncated, it would make sense to either display another level of simplification OR to print only the length (since you can't display the whole list).
The text was updated successfully, but these errors were encountered: