ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / third_party / cython / src / pyximport / test / test_reload.py
blob8013f8dbb822e978d7c880e64cdff6058080ad8e
1 # reload seems to work for Python 2.3 but not 2.2.
2 import time, os, sys
3 import test_pyximport
5 # debugging the 2.2 problem
6 if 1:
7 from distutils import sysconfig
8 try:
9 sysconfig.set_python_build()
10 except AttributeError:
11 pass
12 import pyxbuild
13 print pyxbuild.distutils.sysconfig == sysconfig
15 def test():
16 tempdir = test_pyximport.make_tempdir()
17 sys.path.append(tempdir)
18 hello_file = os.path.join(tempdir, "hello.pyx")
19 open(hello_file, "w").write("x = 1; print x; before = 'before'\n")
20 import hello
21 assert hello.x == 1
23 time.sleep(1) # sleep to make sure that new "hello.pyx" has later
24 # timestamp than object file.
26 open(hello_file, "w").write("x = 2; print x; after = 'after'\n")
27 reload(hello)
28 assert hello.x == 2, "Reload should work on Python 2.3 but not 2.2"
29 test_pyximport.remove_tempdir(tempdir)
31 if __name__=="__main__":
32 test()