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")
Esempio n. 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")
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)
Esempio n. 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)