(blocked: str, missing: str, attribute: str)
| 81 | |
| 82 | |
| 83 | def _hidden_module_script(blocked: str, missing: str, attribute: str) -> str: |
| 84 | # A finder only sees imports not yet cached, so a sqlite3 a site hook already loaded is evicted first. |
| 85 | return f""" |
| 86 | import sys |
| 87 | for name in [name for name in sys.modules if name.partition(".")[0] in {{"sqlite3", "_sqlite3"}}]: |
| 88 | del sys.modules[name] |
| 89 | class Hide: |
| 90 | def find_spec(self, name, path=None, target=None): |
| 91 | if name == {blocked!r}: |
| 92 | raise ModuleNotFoundError(name={missing!r}) |
| 93 | sys.meta_path.insert(0, Hide()) |
| 94 | import filelock |
| 95 | try: |
| 96 | value = getattr(filelock, {attribute!r}) |
| 97 | except ImportError as error: |
| 98 | print(f"error:{{error.name}}") |
| 99 | else: |
| 100 | print("none" if value is None else "resolved") |
| 101 | """ |
| 102 | |
| 103 | |
| 104 | @pytest.mark.parametrize( |
no outgoing calls
no test coverage detected