New submission from Pierre Ossman :
There is a big gotcha in Python that is easily overlooked and should at the
very least be more prominently pointed out in the documentation.
Sorting strings will produce results that is very confusing for humans.
I happens to work for ASCII, but will
New submission from Pierre Ossman :
Right now if you use unittest.mock.patch() as a decorator it may or may not
pass the object as an argument to the test function. The behaviour is a side
effect of the argument "new" rather than something the caller can explicitly
control.
In
Pierre Ossman added the comment:
I've always been cautious about running patch() manually since it was easy to
miss the cleanup. But those fears might be irrelevant these days when we have
addCleanup().
Still, decorators are a more robust in more complex setups since you don'
Change by Pierre Ossman :
--
nosy: +CendioOssman
___
Python tracker
<https://bugs.python.org/issue44185>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Pierre Ossman :
I'd like to write this test case:
with patch('builtins.open') as pyopen:
mock_open(pyopen, read_data="foo")
run()
pyopen.assert_has_calls([call("filename", "wt"),
Pierre Ossman added the comment:
Also see Issue44185 for __exit__.
--
___
Python tracker
<https://bugs.python.org/issue44503>
___
___
Python-bugs-list mailin
New submission from Pierre Ossman :
unittest.mock.patch() as it currently works cannot properly mock a method as it
currently replaces it with something more mimicking a function. I.e. the
descriptor magic that includes "self" isn't properly set up.
In most cases this doesn&
Pierre Ossman added the comment:
autospec's behaviour for methods is currently needed to work around Issue42556,
so be careful with any fixes here so they don't break that workaround.
--
nosy: +CendioOssman
___
Python track
New submission from Pierre Ossman :
These three things do not mix:
- AttributeError
- Threads
- Object methods
An unhandled AttributeError thrown in a thread will not call sys.excepthook if
the thread's start function is a class/object method.
Test case:
import sys
import thread
New submission from Pierre Ossman :
sudo breaks exception handling in Python in some subtle way. The following test
program works fine when run directly, but breaks when run through sudo:
#!/usr/bin/python
import time
def a():
try:
while True
Pierre Ossman added the comment:
Indeed. I assume old style classes are still supported though?
--
___
Python tracker
<http://bugs.python.org/issue14474>
___
___
Pierre Ossman added the comment:
Well that was fast. :)
Sounds very much like the same bug I'm seeing here, yes. Unfortunately I'm not
sure it's sufficient for us to rely on the distributions to update their sudo
packages. A workaround would be preferable. I'll see if I
12 matches
Mail list logo