[issue45833] NamedTemporaryFile deleted before enclosing context manager exit

2021-11-17 Thread Brian McCutchon
New submission from Brian McCutchon : Consider the following code: # Copyright 2021 Google LLC. # SPDX-License-Identifier: Apache-2.0 import contextlib import os @contextlib.contextmanager def my_tmp_file(): with tempfile.NamedTemporaryFile('w') as f: yield f os.stat(m

[issue36395] Add deferred single-threaded/fake executor to concurrent.futures

2019-03-21 Thread Brian McCutchon
New submission from Brian McCutchon : Currently, it is possible to make a basic single-threaded executor for unit testing: class FakeExecutor(futures.Executor): def submit(self, f, *args, **kwargs): future = futures.Future() future.set_result(f(*args, **kwargs)) return future

[issue36395] Add deferred single-threaded/fake executor to concurrent.futures

2019-05-06 Thread Brian McCutchon
Brian McCutchon added the comment: Mostly nondeterminism. It seems like creating a ThreadPoolExecutor with one worker could still be nondeterministic, as there are two threads: the main thread and the worker thread. It gets worse if multiple executors are needed. Another option would be to

[issue36395] Add deferred single-threaded/fake executor to concurrent.futures

2019-05-06 Thread Brian McCutchon
Brian McCutchon added the comment: I understand your hesitation to add a fake. Would it be better to make it possible to subclass Executor so that a third party implementation of this can be developed? As for an example, here is an example of nondeterminism when using a ThreadPoolExecutor

[issue36395] Add deferred single-threaded/fake executor to concurrent.futures

2019-05-07 Thread Brian McCutchon
Brian McCutchon added the comment: No, I do not have such an example, as most of my tests try to fake the executors. -- ___ Python tracker <https://bugs.python.org/issue36