1 from test_support
import TESTFN
, TestFailed
7 # Brief digression to test that import is case-sensitive: if we got this
8 # far, we know for sure that "random" exists.
14 raise TestFailed("import of RAnDoM should have failed (case mismatch)")
16 sys
.path
.insert(0, os
.curdir
)
18 source
= TESTFN
+ ".py"
23 print >> f
, "# This will test Python's ability to import a .py file"
24 a
= random
.randrange(1000)
25 b
= random
.randrange(1000)
32 mod
= __import__(TESTFN
)
33 except ImportError, err
:
34 raise ValueError, "import from .py failed: %s" % err
36 if mod
.a
!= a
or mod
.b
!= b
:
39 raise ValueError, "module loaded (%s) but contents invalid" % mod
46 except ImportError, err
:
47 raise ValueError, "import from .pyc/.pyo failed: %s" % err