Show More
@@ -1339,13 +1339,11 b' def test_run_module_from_import_hook():' | |||||
1339 | return importlib.util.spec_from_loader(fullname, self) |
|
1339 | return importlib.util.spec_from_loader(fullname, self) | |
1340 |
|
1340 | |||
1341 | def get_filename(self, fullname): |
|
1341 | def get_filename(self, fullname): | |
1342 |
|
|
1342 | assert fullname == "my_tmp": | |
1343 | raise ImportError(f"unexpected module name '{fullname}'") |
|
|||
1344 | return fullpath |
|
1343 | return fullpath | |
1345 |
|
1344 | |||
1346 | def get_data(self, path): |
|
1345 | def get_data(self, path): | |
1347 |
|
|
1346 | assert Path(path).samefile(fullpath): | |
1348 | raise OSError(f"expected path '{fullpath}', got '{path}'") |
|
|||
1349 | return Path(fullpath).read_text() |
|
1347 | return Path(fullpath).read_text() | |
1350 |
|
1348 | |||
1351 | sys.meta_path.insert(0, MyTempImporter()) |
|
1349 | sys.meta_path.insert(0, MyTempImporter()) |
General Comments 0
You need to be logged in to leave comments.
Login now