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

2020-05-22 Thread Leonardo Santagada
Leonardo Santagada added the comment: I have a single example: Profiling. As most python profilers don't support threads or processes, it would be very convenient to have a in process executor in those cases. -- nosy: +santagada ___ Python tracker

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

2019-05-08 Thread Brian Quinlan
Brian Quinlan added the comment: Brian, I was looking for an example where the current executor isn't sufficient for testing i.e. a useful test that would be difficult to write with a real executor but would be easier with a fake. Maybe you have such an example from your tests? --

[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 ___ ___

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

2019-05-07 Thread Brian Quinlan
Brian Quinlan added the comment: Hey Brian, I understand the non-determinism. I was wondering if you had a non-theoretical example i.e. some case where the non-determinism had impacted a real test that you wrote? -- ___ Python tracker

[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 w

[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 d

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

2019-05-06 Thread Brian Quinlan
Brian Quinlan added the comment: Do you have a example that you could share? I can't think of any other fakes in the standard library and I'm hesitant to be the person who adds the first one ;-) -- ___ Python tracker

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

2019-05-06 Thread Brian Quinlan
Brian Quinlan added the comment: Hey Brian, why can't you use threads in your unit tests? Are you worried about non-determinism or resource usage? Could you make a ThreadPoolExecutor with a single worker? -- ___ Python tracker

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

2019-03-21 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +bquinlan, pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

[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