()
| 974 | |
| 975 | |
| 976 | def test_extension(): |
| 977 | # Debugging information for failures of this test |
| 978 | assert "daft_extension" not in sys.modules |
| 979 | daft_path = os.path.join(os.path.dirname(__file__), "fake_ext_dir") |
| 980 | if daft_path in sys.path: |
| 981 | # it is likely pytest added this path |
| 982 | # when scanning for tests |
| 983 | sys.path.remove(daft_path) |
| 984 | print("sys.path:") |
| 985 | for p in sys.path: |
| 986 | print(" ", p) |
| 987 | print("CWD", os.getcwd()) |
| 988 | |
| 989 | with pytest.raises(ModuleNotFoundError): |
| 990 | import daft_extension |
| 991 | |
| 992 | with pytest.raises(ModuleNotFoundError): |
| 993 | _ip.run_line_magic("load_ext", "daft_extension") |
| 994 | sys.path.insert(0, daft_path) |
| 995 | import daft_extension |
| 996 | |
| 997 | try: |
| 998 | _ip.user_ns.pop("arq", None) |
| 999 | invalidate_caches() # Clear import caches |
| 1000 | _ip.run_line_magic("load_ext", "daft_extension") |
| 1001 | assert _ip.user_ns["arq"] == 185 |
| 1002 | _ip.run_line_magic("unload_ext", "daft_extension") |
| 1003 | assert "arq" not in _ip.user_ns |
| 1004 | finally: |
| 1005 | sys.path.remove(daft_path) |
| 1006 | |
| 1007 | |
| 1008 | def test_notebook_export_json(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…