예제 #1
0
def test_load_broken_pyc():
    fn = _py_file()
    try:
        imp.load_compiled('test_imp_extra_AUTO5', fn)
    except ImportError:
        pass
    else:
        raise Exception("expected an ImportError")
예제 #2
0
def test_load_broken_pyc():
    fn = _py_file()
    try:
        imp.load_compiled('test_imp_extra_AUTO5', fn)
    except ImportError:
        pass
    else:
        raise Exception("expected an ImportError")
예제 #3
0
def test_load_module_pyc():
    fn = _pyc_file()
    try:
        mod = imp.load_compiled('test_imp_extra_AUTO4', fn)
        assert mod.marker == 42
        import test_imp_extra_AUTO4
        assert mod is test_imp_extra_AUTO4
    finally:
        os.unlink(fn)
예제 #4
0
def test_load_module_pyc():
    fn = _pyc_file()
    try:
        mod = imp.load_compiled('test_imp_extra_AUTO4', fn)
        assert mod.marker == 42
        import test_imp_extra_AUTO4
        assert mod is test_imp_extra_AUTO4
    finally:
        os.unlink(fn)