Commits

Ronny Pfannschmidt  committed 6e86fd0

use py.test.config.option instead of the contest aliases

  • Participants
  • Parent commits 8ffe18b
  • Branches pytest

Comments (0)

Files changed (47)

File rpython/annotator/test/test_annrpython.py

 from __future__ import with_statement
 import py.test
 import sys
-from rpython.conftest import option
 
 from rpython.annotator import model as annmodel
 from rpython.annotator.annrpython import RPythonAnnotator as _RPythonAnnotator
     class RPythonAnnotator(_RPythonAnnotator):
         def build_types(self, *args):
             s = _RPythonAnnotator.build_types(self, *args)
-            if option.view:
+            if py.test.config.option.view:
                 self.translator.view()
             return s
 

File rpython/flowspace/test/test_generator.py

-from rpython.conftest import option
+import py
 from rpython.flowspace.objspace import FlowObjSpace
 from rpython.flowspace.model import Variable
 from rpython.flowspace.generator import (make_generatoriterator_class,
             yield n
         #
         graph = FlowObjSpace().build_flow(func)
-        if option.view:
+        if py.test.config.option.view:
             graph.show()
         block = graph.startblock
         ops = block.operations
         GeneratorIterator = make_generatoriterator_class(graph)
         replace_graph_with_bootstrap(GeneratorIterator, graph)
         func1 = attach_next_method(GeneratorIterator, graph)
-        if option.view:
+        if py.test.config.option.view:
             graph.show()
         #
         assert func1._generator_next_method_of_ is GeneratorIterator
         #
         graph_next = space.build_flow(GeneratorIterator.next.im_func)
         join_blocks(graph_next)
-        if option.view:
+        if py.test.config.option.view:
             graph_next.show()
         #
         graph1 = space.build_flow(func1)
-        if option.view:
+        if py.test.config.option.view:
             graph1.show()
 
     def test_automatic(self):
             z -= 10
         #
         graph = FlowObjSpace().build_flow(f)
-        if option.view:
+        if py.test.config.option.view:
             graph.show()
         block = graph.startblock
         assert len(block.exits) == 1

File rpython/flowspace/test/test_objspace.py

 from rpython.translator.simplify import simplify_graph
 from rpython.flowspace.objspace import FlowObjSpace
 from rpython.flowspace.flowcontext import FlowingError, FlowSpaceFrame
-from rpython.conftest import option
 from rpython.tool.stdlib_opcode import host_bytecode_spec
 
 import os
         return graph
 
     def show(self, graph):
-        if option.view:
+        if py.test.config.option.view:
             graph.show()
 
     def setup_class(cls):

File rpython/jit/metainterp/compile.py

 import weakref
+import py
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rtyper.ootypesystem import ootype
 from rpython.flowspace.model import Constant, Variable
 from rpython.rlib.debug import debug_start, debug_stop, debug_print
 from rpython.rlib import rstack
 from rpython.rlib.jit import JitDebugInfo, Counters, dont_look_inside
-from rpython.conftest import option
 from rpython.tool.sourcetools import func_with_new_name
 
 from rpython.jit.metainterp.resoperation import ResOperation, rop, get_deep_immutable_oplist
 
 def show_procedures(metainterp_sd, procedure=None, error=None):
     # debugging
+    option = py.test.config.option
     if option.view or option.viewloops:
         if error:
             errmsg = error.__class__.__name__

File rpython/jit/metainterp/history.py

 from rpython.rlib.objectmodel import compute_unique_id
 from rpython.rlib.rarithmetic import r_int64, is_valid_int
 
-from rpython.conftest import option
-
 from rpython.jit.metainterp.resoperation import ResOperation, rop
 from rpython.jit.codewriter import heaptracker, longlong
 from rpython.rlib.objectmodel import compute_identity_hash
             loop.check_consistency()
 
     def maybe_view(self):
-        if option.view:
+        if py.test.config.option.view:
             self.view()
 
     def view(self, errmsg=None, extraprocedures=[], metainterp_sd=None):

File rpython/jit/metainterp/test/test_memmgr.py

     import rpython.conftest
     class opt:
         pass
+    #XXX: strangefail?
     rpython.conftest.option = opt()
     rpython.conftest.option.__dict__.update(eval(sys.argv[3]))
 

File rpython/jit/tl/jittest.py

 target --jittest.  Feel free to hack it as needed; it is imported
 only after the '---> Checkpoint' fork.
 """
-
-from rpython.conftest import option
+import py
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rtyper.llinterp import LLInterpreter
 from rpython.rtyper.annlowlevel import llstr
 
 def apply_jit(policy, interp, graph, CPUClass):
     print 'warmspot.jittify_and_run() started...'
-    option.view = True
+    #XXX: why here?
+    py.test.config.option.view = True
     LIST = graph.getargs()[0].concretetype
     lst = LIST.TO.ll_newlist(len(ARGS))
     for i, arg in enumerate(ARGS):

File rpython/rlib/test/test_jit.py

 import py
 
-from rpython.conftest import option
 from rpython.annotator.model import UnionError
 from rpython.rlib.jit import (hint, we_are_jitted, JitDriver, elidable_promote,
     JitHintError, oopspec, isconstant)
                 n -= 1
             return n
         t = self.gengraph(fn, [int])[0]
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         # assert did not raise
 

File rpython/rlib/test/test_nonconst.py

 
 """ Test of non-constant constant.
 """
-
+import py
 from rpython.rlib.nonconst import NonConstant
 
 from rpython.flowspace.objspace import FlowObjSpace
 from rpython.annotator.annrpython import RPythonAnnotator
-from rpython.conftest import option
 from rpython.annotator.model import SomeInstance
 
 def test_nonconst():
     s = a.build_types(nonconst_i, [])
     rtyper = a.translator.buildrtyper(type_system="ootype")
     rtyper.specialize()
-    if option.view:
+    if py.test.config.option.view:
         a.translator.view()
     assert isinstance(s, SomeInstance)
 
 
     rtyper = a.translator.buildrtyper(type_system="ootype")
     rtyper.specialize()
-    if option.view:
+    if py.test.config.option.view:
         a.translator.view()

File rpython/rlib/test/test_objectmodel.py

 from rpython.translator.translator import TranslationContext, graphof
 from rpython.rtyper.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
 from rpython.rtyper.test.test_llinterp import interpret
-from rpython.conftest import option
 
 def strange_key_eq(key1, key2):
     return key1[0] == key2[0]   # only the 1st character is relevant
     typer.specialize()
     backend_optimizations(t)
     graph = graphof(t, f)
-    if option.view:
+    if py.test.config.option.view:
         graph.show()
     return graph
 

File rpython/rtyper/lltypesystem/test/test_rffi.py

 from rpython.rtyper.rtyper import RPythonTyper
 from rpython.translator.backendopt.all import backend_optimizations
 from rpython.translator.translator import graphof
-from rpython.conftest import option
 from rpython.flowspace.model import summary
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.rlib.rarithmetic import r_singlefloat
         rtyper.specialize()
         a.translator.rtyper = rtyper
         backend_optimizations(a.translator)
-        if option.view:
+        if py.test.config.option.view:
             a.translator.view()
         graph = graphof(a.translator, f)
         s = summary(graph)

File rpython/rtyper/lltypesystem/test/test_rtagged.py

 from rpython.translator.translator import graphof
 from rpython.flowspace.model import summary
 from rpython.translator.backendopt.all import backend_optimizations
-from rpython.conftest import option
 
 
 class A(object):
     t = interp.typer.annotator.translator
     t.config.translation.backendopt.constfold = True
     backend_optimizations(t)
-    if option.view:
+    import py
+    if py.test.config.option.view:
         t.view()
 
     LLFrame = interp.frame_class

File rpython/rtyper/memory/gctransform/test/test_refcounting.py

 from rpython.rtyper.lltypesystem import lltype
 from rpython.translator.translator import TranslationContext, graphof
 from rpython.translator.c.gc import RefcountingGcPolicy
-from rpython.conftest import option
 
 class TestLLInterpedRefcounting(LLInterpedTranformerTests):
     gcpolicy = RefcountingGcPolicy
     fptr = getattr(transformer, attr)(TYPE)
     transformer.transform_graph(graphof(t, f))
     transformer.finish(backendopt=False)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     if fptr:
         return fptr._obj.graph, t

File rpython/rtyper/memory/gctransform/test/test_transform.py

+import py
 from rpython.rtyper.memory.gctransform.transform import BaseGCTransformer
 from rpython.flowspace.model import c_last_exception, Variable
 from rpython.translator.backendopt.support import var_needsgc
 from rpython.translator.translator import TranslationContext, graphof
 from rpython.translator.exceptiontransform import ExceptionTransformer
 from rpython.rtyper.lltypesystem import lltype
-from rpython.conftest import option
 
 
 class LLInterpedTranformerTests:
             if isinstance(v.concretetype, lltype.Ptr):
                 assert v.concretetype.TO._gckind != 'gc', "fix the test!"
         llinterp = LLInterpreter(t.rtyper)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         return llinterp, graph
 
     t.buildannotator().build_types(func, inputtypes)
     if specialize:
         t.buildrtyper().specialize()
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     return t
 
     graphs_borrowed = {}
     for graph in t.graphs[:]:
         graphs_borrowed[graph] = transformer.transform_graph(graph)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     t.checkgraphs()
     if check:

File rpython/rtyper/memory/test/test_transformed_gc.py

 from rpython.rlib.objectmodel import compute_unique_id, we_are_translated
 from rpython.rlib.debug import ll_assert
 from rpython.rlib import rgc
-from rpython.conftest import option
 from rpython.rlib.rstring import StringBuilder
 from rpython.rlib.rarithmetic import LONG_BIT
 
     if backendopt:
         from rpython.translator.backendopt.all import backend_optimizations
         backend_optimizations(t)
-    if option.view:
+    if py.test.config.option.view:
         t.viewcg()
     return t
 
         db = cbuild.generate_graphs_for_llinterp()
         entrypointptr = cbuild.getentrypointptr()
         entrygraph = entrypointptr._obj.graph
-        if option.view:
+        if py.test.config.option.view:
             t.viewcg()
 
         cls.name_to_func = name_to_func

File rpython/rtyper/ootypesystem/test/test_oortype.py

 import py
-from rpython.conftest import option
 from rpython.rtyper.ootypesystem.ootype import *
 from rpython.rtyper.ootypesystem import ootype
 from rpython.rtyper.ootypesystem.rlist import ListRepr
     t = TranslationContext()
     t.config.translation.ootype.mangle = mangle
     t.buildannotator().build_types(f, args)
-    if viewBefore or option.view:
+    if viewBefore or py.test.config.option.view:
         t.view()
     t.buildrtyper(type_system="ootype").specialize()
-    if viewAfter or option.view:
+    if viewAfter or py.test.config.option.view:
         t.view()
     return graphof(t, f)
 
 
     t = TranslationContext()
     t.buildannotator().build_types(f, [])
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     rtyper = t.buildrtyper(type_system="ootype")
     rtyper.specialize()

File rpython/rtyper/test/test_llann.py

 import py
 
 from rpython.annotator import model as annmodel
-from rpython.conftest import option
 from rpython.flowspace.objspace import FlowObjSpace
 from rpython.rtyper.annlowlevel import (annotate_lowlevel_helper,
     MixLevelHelperAnnotator, PseudoHighLevelCallable, llhelper,
     def annotate(self, ll_function, argtypes):
         self.a = self.RPythonAnnotator()
         graph = annotate_lowlevel_helper(self.a, ll_function, argtypes)
-        if option.view:
+        if py.test.config.option.view:
             self.a.translator.view()
         return self.a.binding(graph.getreturnvar())
 

File rpython/rtyper/test/test_llinterp.py

 from rpython.annotator.model import lltype_to_annotation
 from rpython.rlib.rarithmetic import r_uint, ovfcheck
 from rpython.tool import leakfinder
-from rpython.conftest import option
 
 
 # switch on logging of interp to show more info on failing tests
     a = t.buildannotator(policy=policy)
     timelog("annotating", a.build_types, func, argtypes, main_entry_point=True)
     if viewbefore == 'auto':
-        viewbefore = getattr(option, 'view', False)
+        viewbefore = py.test.config.option.view
     if viewbefore:
         a.simplify()
         t.view()
         if len(_lastinterpreted) >= 4: 
             del _tcache[_lastinterpreted.pop(0)]
     if view == 'auto':
-        view = getattr(option, 'view', False)
+        view = py.test.config.option.view
     if view:
         t.view()
     return interp, graph

File rpython/rtyper/test/test_rstr.py

             return const("head")+tail
         def f():
             return g(const("tail"))
-        from rpython.conftest import option
 
         t, typer, fgraph = self.gengraph(f, [], backendopt=True)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         assert summary(fgraph) == {}
 

File rpython/rtyper/test/test_rvirtualizable2.py

 from rpython.flowspace.model import summary
 from rpython.rtyper.llinterp import LLInterpreter
 from rpython.rtyper.rclass import IR_IMMUTABLE, IR_IMMUTABLE_ARRAY
-from rpython.conftest import option
 
 
 class V(object):
         op_getfield = block.operations[-1]
         assert op_getfield.opname in ('getfield', 'oogetfield')
         funcptr = self.replace_force_virtualizable(rtyper, [graph])
-        if getattr(option, 'view', False):
+        if py.test.config.option.view:
             graph.show()
         op_promote = block.operations[-2]
         op_getfield = block.operations[-1]

File rpython/tool/pytest/viewerplugin.py

            help="show only the compiled loops")
 
 
+def maybe_show_graph(graph):
+    if pytest.config.view:
+        graph.show()
+
+
 @pytest.mark.tryfirst
 def pytest_runtest_teardown(__multicall__, item):
     __multicall__.execute()

File rpython/translator/backendopt/test/test_all.py

 from rpython.annotator import model as annmodel
 from rpython.rtyper.llinterp import LLInterpreter
 from rpython.rlib.rarithmetic import intmask
-from rpython.conftest import option
 
 class A:
     def __init__(self, x, y):
         t = TranslationContext()
         t.buildannotator().build_types(func, sig)
         t.buildrtyper(type_system=self.type_system).specialize()
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         backend_optimizations(t, **optflags)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         return t
 
         annhelper.backend_optimize()
         # ^^^ as the inliner can't handle exception-transformed graphs,
         # this should *not* inline common() into later().
-        if option.view:
+        if py.test.config.option.view:
             later_graph.show()
         common_graph = graphof(t, common)
         found = False

File rpython/translator/backendopt/test/test_canraise.py

 from rpython.translator.backendopt.canraise import RaiseAnalyzer
 from rpython.translator.backendopt.all import backend_optimizations
 from rpython.rtyper.test.tool import LLRtypeMixin, OORtypeMixin
-from rpython.conftest import option
 
 class BaseTestCanRaise(object):
     type_system = None
         t = TranslationContext()
         t.buildannotator().build_types(func, sig)
         t.buildrtyper(type_system=self.type_system).specialize()
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         return t, RaiseAnalyzer(t)
 

File rpython/translator/backendopt/test/test_constfold.py

 from rpython.rtyper import rclass
 from rpython.rlib import objectmodel
 from rpython.translator.backendopt.constfold import constant_fold_graph
-from rpython.conftest import option
 
 def get_graph(fn, signature):
     t = TranslationContext()
     t.buildannotator().build_types(fn, signature)
     t.buildrtyper().specialize()
     graph = graphof(t, fn)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     return graph, t
 
 def check_graph(graph, args, expected_result, t):
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     checkgraph(graph)
     interp = LLInterpreter(t.rtyper)
     inline.auto_inline_graphs(t, t.graphs, threshold=999)
     constant_fold_graph(graph)
     removenoops.remove_same_as(graph)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     # check that the graph starts with a condition (which should be 'n==42')
     # and that if this condition is true, it goes directly to 'return 100'.
     from rpython.translator.backendopt import removenoops
     removenoops.remove_same_as(graph)
     constant_fold_graph(graph)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     assert summary(graph) == {'int_gt': 1}
     check_graph(graph, [2], 17, t)
     inline.auto_inline_graphs(t, t.graphs, threshold=999)
     removenoops.remove_same_as(graph)
     constant_fold_graph(graph)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     # check that the graph starts with a condition (which should be 'n > 5')
     # and that if this condition is false, it goes directly to 'return 0'.

File rpython/translator/backendopt/test/test_escape.py

 from rpython.translator.backendopt.escape import AbstractDataFlowInterpreter
 from rpython.translator.backendopt.escape import malloc_like_graphs
 from rpython.rlib.objectmodel import instantiate
-from rpython.conftest import option
 
 def build_adi(function, types):
     t = Translation(function, types)
     t.rtype()
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     adi = AbstractDataFlowInterpreter(t.context)
     graph = graphof(t.context, function)

File rpython/translator/backendopt/test/test_finalizer.py

 from rpython.translator.backendopt.all import backend_optimizations
 from rpython.translator.unsimplify import varoftype
 from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.conftest import option
 from rpython.rlib import rgc
 
 
         t.buildrtyper(type_system=self.type_system).specialize()
         if backendopt:
             backend_optimizations(t)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         a = FinalizerAnalyzer(t)
         fgraph = graphof(t, func_to_analyze)

File rpython/translator/backendopt/test/test_inline.py

 from rpython.rlib.rarithmetic import ovfcheck
 from rpython.translator.test.snippet import is_perfect_number
 from rpython.translator.backendopt.all import INLINE_THRESHOLD_FOR_TEST
-from rpython.conftest import option
 from rpython.translator.backendopt import removenoops
 from rpython.flowspace.model import summary
 
         t = self.translate(entry, sig)
         # inline!
         sanity_check(t)    # also check before inlining (so we don't blame it)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         raise_analyzer = canraise.RaiseAnalyzer(t)
         inliner = Inliner(t, graphof(t, in_func), func,
                           inline_guarded_calls,
                           raise_analyzer=raise_analyzer)
         inliner.inline_all()
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         sanity_check(t)
         interp = LLInterpreter(t.rtyper)
             for graph in t.graphs:
                 constant_fold_graph(graph)
                 eliminate_empty_blocks(graph)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         # inline!
         sanity_check(t)    # also check before inlining (so we don't blame it)
         auto_inlining(t, threshold, call_count_pred=call_count_pred, **kwargs)
 
         sanity_check(t)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         interp = LLInterpreter(t.rtyper)
         def eval_func(args):

File rpython/translator/backendopt/test/test_innerloop.py

 from rpython.translator.translator import TranslationContext
 from rpython.translator.backendopt.innerloop import find_inner_loops
-from rpython.conftest import option
 
 def test_simple_loop():
     def snippet_fn(x, y):
         return y
     t = TranslationContext()
     graph = t.buildflowgraph(snippet_fn)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     loops = find_inner_loops(graph)
     assert len(loops) == 1
         return y
     t = TranslationContext()
     graph = t.buildflowgraph(snippet_fn)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     loops = find_inner_loops(graph)
     assert len(loops) == 2
         return z
     t = TranslationContext()
     graph = t.buildflowgraph(snippet_fn)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     loops = find_inner_loops(graph)
     assert len(loops) == 1

File rpython/translator/backendopt/test/test_malloc.py

 from rpython.rtyper.lltypesystem import lltype, llmemory
 from rpython.rtyper.ootypesystem import ootype
 from rpython.rlib import objectmodel
-from rpython.conftest import option
 
 class BaseMallocRemovalTest(object):
     type_system = None
         if inline is not None:
             from rpython.translator.backendopt.inline import auto_inline_graphs
             auto_inline_graphs(t, t.graphs, inline)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         # to detect broken intermediate graphs,
         # we do the loop ourselves instead of calling remove_simple_mallocs()
             progress = remover.remove_mallocs_once(graph)
             simplify.transform_dead_op_vars_in_blocks(list(graph.iterblocks()),
                                                       [graph])
-            if progress and option.view:
+            if progress and py.test.config.option.view:
                 t.view()
             if expected_result is not Ellipsis:
                 interp = LLInterpreter(t.rtyper)

File rpython/translator/backendopt/test/test_mallocprediction.py

 from rpython.translator.translator import TranslationContext, graphof
 from rpython.rtyper.llinterp import LLInterpreter
 from rpython.flowspace.model import checkgraph, Block
-from rpython.conftest import option
 import sys
 
 from rpython.translator.backendopt.mallocprediction import *
     t.buildannotator().build_types(fn, signature)
     t.buildrtyper().specialize()
     graph = graphof(t, fn)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     return t, graph
     

File rpython/translator/backendopt/test/test_mallocv.py

 from rpython.rtyper.annlowlevel import llhelper
 from rpython.rlib import objectmodel
 from rpython.rlib.rarithmetic import ovfcheck
-from rpython.conftest import option
 
 DONT_CHECK_RESULT = object()
 class CHECK_RAISES:
         t.buildannotator().build_types(fn, signature)
         t.buildrtyper(type_system=self.type_system).specialize()
         graph = graphof(t, fn)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         self.original_graph_count = len(t.graphs)
         # to detect broken intermediate graphs,
         while True:
             progress = mallocv.remove_mallocs_once()
             #simplify.transform_dead_op_vars_in_blocks(list(graph.iterblocks()))
-            if progress and option.view:
+            if progress and py.test.config.option.view:
                 t.view()
             t.checkgraphs()
             if expected_result is not DONT_CHECK_RESULT:

File rpython/translator/backendopt/test/test_removenoops.py

 from rpython.rtyper.lltypesystem import lltype
 from rpython.rtyper.lltypesystem.lloperation import llop
 from rpython.rtyper.llinterp import LLInterpreter
-from rpython.conftest import option
 
 import py
 log = py.log.Producer('test_backendoptimization')
                               constfold=False,
                               raisingop2direct_call=False)
     graph = graphof(t, fn)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     return graph, t
 
     num_cast_pointer = len(getops(graph_getsum)['cast_pointer'])
     changed = remove_duplicate_casts(graph_getsum, t)
     assert changed
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     check_graph(graph, [10, True], 75, t)
     ops = getops(graph_getsum)

File rpython/translator/backendopt/test/test_storesink.py

 from rpython.translator.backendopt.storesink import storesink_graph
 from rpython.translator.backendopt import removenoops
 from rpython.flowspace.model import last_exception, checkgraph
-from rpython.conftest import option
 
 class TestStoreSink(object):
     # not sure if it makes any sense on ootype, maybe worth trying
         checkgraph(graph)
         storesink_graph(graph)
         checkgraph(graph)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         for block in graph.iterblocks():
             for op in block.operations:

File rpython/translator/backendopt/test/test_writeanalyze.py

 from rpython.translator.backendopt.writeanalyze import WriteAnalyzer, top_set
 from rpython.translator.backendopt.writeanalyze import ReadWriteAnalyzer
 from rpython.translator.backendopt.all import backend_optimizations
-from rpython.conftest import option
 
 
 class BaseTest(object):
         t = TranslationContext()
         t.buildannotator().build_types(func, sig)
         t.buildrtyper(type_system=self.type_system).specialize()
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         return t, self.Analyzer(t)
 

File rpython/translator/c/gcc/test/test_asmgcroot.py

 from rpython.translator.translator import TranslationContext
 from rpython.translator.c.genc import CStandaloneBuilder
 from rpython.annotator.listdef import s_list_of_strings
-from rpython.conftest import option
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator.platform import platform as compiler
 from rpython.rlib.rarithmetic import is_emulated_long
         c_source_filename = cbuilder.generate_source(
             defines = cbuilder.DEBUG_DEFINES)
         cls._patch_makefile(cbuilder.targetdir)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         exe_name = cbuilder.compile()
 

File rpython/translator/c/test/test_backendoptimized.py

-from rpython.conftest import option
 from rpython.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong
 from rpython.translator.backendopt.all import backend_optimizations
 from rpython.translator.c.test.test_typed import TestTypedTestCase as _TestTypedTestCase

File rpython/translator/c/test/test_newgc.py

 
 import py
 
-from rpython.conftest import option
 from rpython.rlib import rgc
 from rpython.rlib.objectmodel import keepalive_until_here, compute_hash, compute_identity_hash
 from rpython.rlib.rstring import StringBuilder
         t.disable(['backendopt'])
         t.set_backend_extra_options(c_debug_defines=True)
         t.rtype()
-        if option.view:
+        if py.test.config.option.view:
             t.viewcg()
         exename = t.compile()
 
         for fullname in dir(cls):
             if not fullname.startswith('define'):
                 continue
-            keyword = option.keyword
+            keyword = py.test.config.option.keyword
             if keyword.startswith('test_'):
                 keyword = keyword[len('test_'):]
                 if keyword not in fullname:

File rpython/translator/c/test/test_refcount.py

 from rpython.translator.c import genc
 from rpython.translator.c.test.test_genc import compile
 from rpython.rtyper.lltypesystem import lltype
-from rpython.conftest import option
 
 def compile_func(func, args):
     return compile(func, args, gcpolicy='ref')

File rpython/translator/c/test/test_rtagged.py

 # only with Boehm so far
 
 from rpython.translator.interactive import Translation
-from rpython.conftest import option
 
 def test_tagged_boehm():
     t = Translation(entry_point, gc='boehm', taggedpointers=True)
     try:
         exename = str(t.compile_c())
     finally:
-        if option.view:
+        import py
+        if py.test.config.option.view:
             t.view()
     g = os.popen(exename, 'r')
     data = g.read()

File rpython/translator/c/test/test_standalone.py

 from rpython.annotator.listdef import s_list_of_strings
 from rpython.tool.udir import udir
 from rpython.conftest import cdir
-from rpython.conftest import option
 
 
 class StandaloneTests(object):
         else:
             cbuilder.generate_source()
         cbuilder.compile()
-        if option is not None and option.view:
+        if py.test.config.option.view:
             t.view()
         return t, cbuilder
 

File rpython/translator/c/test/test_symbolic.py

 from rpython.translator.interactive import Translation
 from rpython.translator.c.test.test_genc import compile
-from rpython.conftest import option
 from rpython.rtyper.lltypesystem import llmemory, lltype
 from rpython.rlib.objectmodel import ComputedIntSymbolic
 
 
     t = Translation(f)
     t.rtype()
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     too_early = False
     fn = compile(f, [int])

File rpython/translator/cli/option.py

-from rpython.conftest import option
+import py
 
 _defaultopt = dict(wd = False, source = False, nostop = False, stdout = False)
 
 def getoption(name):
-    return getattr(option, name, _defaultopt.get(name))
+    return getattr(py.test.config.option, name, _defaultopt.get(name))

File rpython/translator/jvm/option.py

-from rpython.conftest import option
+import py
 
 # Not sure why this is needed.  Sure that it shouldn't be, even.
 _default_values = {
 
 def getoption(name):
     if hasattr(option, name):
-        return getattr(option, name)
+        return getattr(py.test.config.option, name)
     return _default_values[name]

File rpython/translator/oosupport/test/test_treebuilder.py

 from rpython.rtyper.llinterp import LLInterpreter
 from rpython.translator.translator import TranslationContext, graphof
 from rpython.translator.oosupport.treebuilder import build_trees, SubOperation
-from rpython.conftest import option
 from rpython.rtyper.test.test_rlist import BaseTestRlist
 from rpython.rtyper.test.tool import BaseRtypingTest, OORtypeMixin
 from rpython.rtyper.test.test_llinterp import get_interpreter
 
 def check_trees(func, argtypes, backendopt=False):
     t = translate(func, argtypes, backendopt=backendopt)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     graph = graphof(t, func)
     build_trees(graph)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     interp = LLInterpreter(t.rtyper)
     def eval_func(*args):
 class BuildTreeRtypingTest(BaseRtypingTest, OORtypeMixin):
     def interpret(self, fn, args):
         interp, graph = get_interpreter(fn, args, view=False, viewbefore=False, type_system=self.type_system)
-        if option.view:
+        if py.test.config.option.view:
             interp.typer.annotator.translator.view()
         build_trees(graph)
-        if option.view:
+        if py.test.config.option.view:
             interp.typer.annotator.translator.view()
         return interp.eval_graph(graph, args)
 

File rpython/translator/test/test_exceptiontransform.py

 from rpython.flowspace.model import summary
 from rpython.rtyper.test.test_llinterp import get_interpreter
 from rpython.translator.backendopt.all import backend_optimizations
-from rpython.conftest import option
 import sys
 
 def check_debug_build():
     # the 'not option.view' is because debug builds rarely
     # have pygame, so if you want to see the graphs pass --view and
     # don't be surprised when the test then passes when it shouldn't.
-    if not hasattr(sys, 'gettotalrefcount') and not option.view:
+    if not hasattr(sys, 'gettotalrefcount') and not py.test.config.option.view:
         py.test.skip("test needs a debug build of Python")
 
 _already_transformed = {}
         t = TranslationContext()
         t.buildannotator().build_types(fn, inputtypes)
         t.buildrtyper(type_system=self.type_system).specialize()
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         if backendopt:
             backend_optimizations(t)
         etrafo = exceptiontransform.ExceptionTransformer(t)
         etrafo.create_exception_handling(g)
         join_blocks(g)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         return t, g
 

File rpython/translator/test/test_simplify.py

 from rpython.translator.simplify import (get_graph, transform_dead_op_vars,
                                       desugar_isinstance)
 from rpython.flowspace.model import Block, Constant, summary
-from rpython.conftest import option
 
 def translate(func, argtypes, backend_optimize=True):
     t = TranslationContext()
     t.buildrtyper().specialize()
     if backend_optimize:
         backend_optimizations(t)
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     return graphof(t, func), t
 
     def check(self, f1, expected):
         t = TranslationContext(list_comprehension_operations=True)
         graph = t.buildflowgraph(f1)
-        if option.view:
+        if py.test.config.option.view:
             graph.show()
         assert summary(graph) == expected
 
         from rpython.rtyper.llinterp import LLInterpreter
         t = TranslationContext(list_comprehension_operations=True)
         t.buildannotator().build_types(func, argtypes)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         t.buildrtyper(self.typesystem).specialize()
         backend_optimizations(t)
-        if option.view:
+        if py.test.config.option.view:
             t.view()
         graph = graphof(t, func)
         interp = LLInterpreter(t.rtyper)

File rpython/translator/test/test_stackcheck.py

-from rpython.conftest import option
 from rpython.translator.translator import TranslationContext, graphof
 from rpython.translator.backendopt.all import backend_optimizations
 from rpython.translator.transform import insert_ll_stackcheck
     n = insert_ll_stackcheck(t)
     t.checkgraphs()
     assert n == 1
-    if option.view:
+    if py.test.config.option.view:
         t.view()
     check(graphof(t, f), 'f')
 
     exctransf = t.getexceptiontransformer()
     f_graph = graphof(t, f)
     exctransf.create_exception_handling(f_graph)
-    if option.view:
+    if py.test.config.option.view:
         f_graph.show()
     check(f_graph, 'f')    
 
 
     gctransf = GCTransform(t)
     gctransf.transform_graph(f_graph)
-    if option.view:
+    if py.test.config.option.view:
         f_graph.show()
     relevant = check(f_graph, 'f')        
     for p in relevant: