##// END OF EJS Templates
Fix extension detection...
Fix extension detection If the path leading up to the Python installation's `site-packages` contains a `.`, this check does not do what it says it does :( For instance, on macOS, the `site-packages` directory is located at `/usr/local/lib/python3.7/site-packages`, which means that trying to use the magic `%run -m my.module` will always fail, because `split_path[1]` will always start with `7/site-packages`. There are better ways to check that a file extension matches expectations, but I thought it was cute that I could fix this bug by inserting a single character :) My current workaround looks like this: ```python import importlib import_path = importlib.util.find_spec('my.module').origin %run $import_path ```

File last commit:

r15516:43a46eb6
r24836:525c7fe6
Show More
test_decorators.py
9 lines | 170 B | text/x-python | PythonLexer
from IPython.utils import decorators
def test_flag_calls():
@decorators.flag_calls
def f():
pass
assert not f.called
f()
assert f.called