Method
find_spec
(self, name, path=None, target=None)
Source from the content-addressed store, hash-verified
| 71 | self.lock = threading.Lock() |
| 72 | |
| 73 | def find_spec(self, name, path=None, target=None): |
| 74 | # Simulate some thread-unsafe behaviour. If calls to find_spec() |
| 75 | # are properly serialized, `x` will end up the same as `numcalls`. |
| 76 | # Otherwise not. |
| 77 | assert imp.lock_held() |
| 78 | with self.lock: |
| 79 | self.numcalls += 1 |
| 80 | x = self.x |
| 81 | time.sleep(0.01) |
| 82 | self.x = x + 1 |
| 83 | |
| 84 | class FlushingFinder: |
| 85 | """A dummy finder which flushes sys.path_importer_cache when it gets |
Tested by
no test coverage detected