[issue47259] string sorting often incorrect

2022-04-08 Thread Pierre Ossman
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

[issue44503] Hide __enter__ calls in mock_open

2021-06-24 Thread Pierre Ossman
Pierre Ossman added the comment: Also see Issue44185 for __exit__. -- ___ Python tracker <https://bugs.python.org/issue44503> ___ ___ Python-bugs-list mailin

[issue44503] Hide __enter__ calls in mock_open

2021-06-24 Thread Pierre Ossman
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"),

[issue44185] mock_open file handle __exit__ does not call close

2021-05-20 Thread Pierre Ossman
Change by Pierre Ossman : -- nosy: +CendioOssman ___ Python tracker <https://bugs.python.org/issue44185> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44052] patch object as argument should be explicit

2021-05-06 Thread Pierre Ossman
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't have

[issue44052] patch object as argument should be explicit

2021-05-06 Thread Pierre Ossman
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

[issue41915] unittest.mock.create_autospec(Obj, instance=True) has self keyword in _spec_signature if Obj implements __call__

2020-12-04 Thread Pierre Ossman
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 tracker <ht

[issue42556] unittest.mock.patch() cannot properly mock methods

2020-12-03 Thread Pierre Ossman
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't rea

[issue14474] mishandling of AttributeError in threads

2012-04-02 Thread Pierre Ossman
New submission from Pierre Ossman oss...@cendio.se: 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

[issue14476] sudo breaks python

2012-04-02 Thread Pierre Ossman
New submission from Pierre Ossman oss...@cendio.se: 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

[issue14474] mishandling of AttributeError in threads

2012-04-02 Thread Pierre Ossman
Pierre Ossman oss...@cendio.se added the comment: Indeed. I assume old style classes are still supported though? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14474

[issue14476] sudo breaks python

2012-04-02 Thread Pierre Ossman
Pierre Ossman oss...@cendio.se 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 can