[pypy-svn] r16789 - pypy/release/0.7.x/pypy/translator/c/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Aug 27 17:37:30 CEST 2005


Author: cfbolz
Date: Sat Aug 27 17:37:28 2005
New Revision: 16789

Modified:
   pypy/release/0.7.x/pypy/translator/c/test/test_extfunc.py
Log:
added a test that tries to compile unsetenv and test whether it works


Modified: pypy/release/0.7.x/pypy/translator/c/test/test_extfunc.py
==============================================================================
--- pypy/release/0.7.x/pypy/translator/c/test/test_extfunc.py	(original)
+++ pypy/release/0.7.x/pypy/translator/c/test/test_extfunc.py	Sat Aug 27 17:37:28 2005
@@ -477,3 +477,18 @@
     res = chan.receive()
     assert res
     chan.close()
+
+def test_unsetenv():
+    if not hasattr(os, "unsetenv"):
+        py.test.skip("missing unsetenv on this architecture")
+    def unsetenv():
+        os.unsetenv("ABCDEF")
+    f = compile(unsetenv, [])
+    os.putenv("ABCDEF", "a")
+    cmd = '''python -c "import os, sys; sys.exit(os.getenv('ABCDEF') != 'a')"'''
+    assert os.system(cmd) == 0
+    f()
+    cmd = '''python -c "import os, sys; sys.exit(os.getenv('ABCDEF') != None)"'''
+    assert os.system(cmd) == 0
+    f()
+    assert os.system(cmd) == 0



More information about the Pypy-commit mailing list