[pypy-svn] r32802 - pypy/branch/even-more-config/pypy/translator/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Oct 1 20:47:06 CEST 2006


Author: cfbolz
Date: Sun Oct  1 20:47:02 2006
New Revision: 32802

Modified:
   pypy/branch/even-more-config/pypy/translator/test/test_driver.py
Log:
fix test to use configs instead of options


Modified: pypy/branch/even-more-config/pypy/translator/test/test_driver.py
==============================================================================
--- pypy/branch/even-more-config/pypy/translator/test/test_driver.py	(original)
+++ pypy/branch/even-more-config/pypy/translator/test/test_driver.py	Sun Oct  1 20:47:02 2006
@@ -1,6 +1,8 @@
 import py
 
 from pypy.translator.driver import TranslationDriver, DEFAULT_OPTIONS
+from pypy.config.config import Config
+from pypy.config.pypyoption import pypy_optiondescription
 import optparse
 
 def cmpl(l1, l2):
@@ -11,7 +13,8 @@
     return l1 == l2
 
 def test_ctr():
-    td = TranslationDriver()
+    config = Config(pypy_optiondescription, **{"translation.backend": "c"})
+    td = TranslationDriver(config=config)
 
     assert cmpl(td.exposed,
                 ['annotate', 'backendopt', 'llinterpret', 'rtype', 'source', 'compile', 'run'])
@@ -21,40 +24,41 @@
     assert td.backend_select_goals(['rtype']) == ['rtype_lltype']
     assert td.backend_select_goals(['rtype_lltype']) == ['rtype_lltype']
     assert td.backend_select_goals(['backendopt']) == ['backendopt_lltype']
-    assert td.backend_select_goals(['backendopt_lltype']) == ['backendopt_lltype']          
+    assert td.backend_select_goals(['backendopt_lltype']) == [
+        'backendopt_lltype']
 
-    d = DEFAULT_OPTIONS.copy()
-    d['backend'] = None
-    td = TranslationDriver(options=optparse.Values(defaults=d))
+    config = Config(pypy_optiondescription)
+    td = TranslationDriver(config=config)
 
     assert td.backend_select_goals(['compile_c']) == ['compile_c']
     py.test.raises(Exception, td.backend_select_goals, ['compile'])
     py.test.raises(Exception, td.backend_select_goals, ['rtype'])
-    assert td.backend_select_goals(['rtype_lltype']) == ['rtype_lltype']          
+    assert td.backend_select_goals(['rtype_lltype']) == ['rtype_lltype']
     py.test.raises(Exception, td.backend_select_goals, ['backendopt'])
-    assert td.backend_select_goals(['backendopt_lltype']) == ['backendopt_lltype']          
-
+    assert td.backend_select_goals(['backendopt_lltype']) == [
+        'backendopt_lltype']
 
     assert cmpl(td.exposed,
                 ['annotate', 'backendopt_lltype', 'llinterpret_lltype',
-                 'rtype_ootype', 'rtype_lltype',
-                 'source_cl', 'source_js', 'source_squeak', 'source_cli', 'source_c',
-                 'source_llvm', 'compile_cl', 'compile_cli', 'compile_c', 'compile_squeak',
-                 'compile_llvm', 'compile_js', 'run_cl', 'run_squeak', 'run_llvm',
-                 'run_c', 'run_js', 'run_cli'])
-
-    d = DEFAULT_OPTIONS.copy()
-    d['backend'] = None
-    d['type_system'] = 'lltype'
-    td = TranslationDriver(options=optparse.Values(defaults=d))
+                 'rtype_ootype', 'rtype_lltype', 'source_cl', 'source_js',
+                 'source_squeak', 'source_cli', 'source_c', 'source_llvm',
+                 'compile_cl', 'compile_cli', 'compile_c', 'compile_squeak',
+                 'compile_llvm', 'compile_js', 'run_cl', 'run_squeak',
+                 'run_llvm', 'run_c', 'run_js', 'run_cli'])
+
+    config = Config(pypy_optiondescription,
+                    **{"translation.type_system": "lltype"})
+    td = TranslationDriver(config=config)
 
     assert td.backend_select_goals(['compile_c']) == ['compile_c']
     py.test.raises(Exception, td.backend_select_goals, ['compile'])
-    assert td.backend_select_goals(['rtype_lltype']) == ['rtype_lltype']    
-    assert td.backend_select_goals(['rtype']) == ['rtype_lltype']    
+    assert td.backend_select_goals(['rtype_lltype']) == ['rtype_lltype']
+    assert td.backend_select_goals(['rtype']) == ['rtype_lltype']
     assert td.backend_select_goals(['backendopt']) == ['backendopt_lltype']
-    assert td.backend_select_goals(['backendopt_lltype']) == ['backendopt_lltype']          
+    assert td.backend_select_goals(['backendopt_lltype']) == [
+        'backendopt_lltype']
 
     assert cmpl(td.exposed,
-                ['annotate', 'backendopt', 'llinterpret', 'rtype', 'source_c', 'source_llvm',
-                 'compile_c', 'compile_llvm', 'run_llvm', 'run_c'])
+                ['annotate', 'backendopt', 'llinterpret', 'rtype', 'source_c',
+                 'source_llvm', 'compile_c', 'compile_llvm', 'run_llvm',
+                 'run_c'])


More information about the pypy-svn mailing list