Commits

Alexander Hesse committed 9e9c157

Split up conftest

Comments (0)

Files changed (51)

     global option
     option = config.option
 
-def _set_platform(opt, opt_str, value, parser):
-    from rpython.config.translationoption import PLATFORMS
-    from rpython.translator.platform import set_platform
-    if value not in PLATFORMS:
-        raise ValueError("%s not in %s" % (value, PLATFORMS))
-    set_platform(value, None)
-
 def pytest_addoption(parser):
     group = parser.getgroup("pypy options")
-    group.addoption('--view', action="store_true", dest="view", default=False,
-           help="view translation tests' flow graphs with Pygame")
     group.addoption('-A', '--runappdirect', action="store_true",
            default=False, dest="runappdirect",
            help="run applevel tests directly on python interpreter (not through PyPy)")
     group.addoption('--direct', action="store_true",
            default=False, dest="rundirect",
            help="run pexpect tests directly")
-    group.addoption('-P', '--platform', action="callback", type="string",
-           default="host", callback=_set_platform,
-           help="set up tests to use specified platform as compile/run target")
-    group = parser.getgroup("JIT options")
-    group.addoption('--viewloops', action="store_true",
-           default=False, dest="viewloops",
-           help="show only the compiled loops")
-
-def pytest_sessionstart():
-    # have python subprocesses avoid startup customizations by default
-    try:
-        del os.environ['PYTHONSTARTUP']
-    except KeyError:
-        pass
 
 def pytest_funcarg__space(request):
     from pypy.tool.pytest.objspace import gettestobjspace

rpython/annotator/test/test_annrpython.py

 from __future__ import with_statement
 import py.test
 import sys
-from pypy import conftest
+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 conftest.option.view:
+            if option.view:
                 self.translator.view()
             return s
 

rpython/conftest.py

 from os.path import *
+import py, pytest
 
 cdir = realpath(join(dirname(__file__), 'translator', 'c'))
 cache_dir = realpath(join(dirname(__file__), '_cache'))
+option = None
+
+def braindead_deindent(self):
+    """monkeypatch that wont end up doing stupid in the python tokenizer"""
+    text = '\n'.join(self.lines)
+    short = py.std.textwrap.dedent(text)
+    newsource = py.code.Source()
+    newsource.lines[:] = short.splitlines()
+    return newsource
+
+py.code.Source.deindent = braindead_deindent
+
+def pytest_report_header():
+    return "pytest-%s from %s" %(pytest.__version__, pytest.__file__)
+
+def pytest_configure(config):
+    global option
+    option = config.option
+
+def _set_platform(opt, opt_str, value, parser):
+    from rpython.config.translationoption import PLATFORMS
+    from rpython.translator.platform import set_platform
+    if value not in PLATFORMS:
+        raise ValueError("%s not in %s" % (value, PLATFORMS))
+    set_platform(value, None)
+
+def pytest_addoption(parser):
+    group = parser.getgroup("rpython options")
+    group.addoption('--view', action="store_true", dest="view", default=False,
+           help="view translation tests' flow graphs with Pygame")
+    group.addoption('-P', '--platform', action="callback", type="string",
+           default="host", callback=_set_platform,
+           help="set up tests to use specified platform as compile/run target")
+    group = parser.getgroup("JIT options")
+    group.addoption('--viewloops', action="store_true",
+           default=False, dest="viewloops",
+           help="show only the compiled loops")

rpython/flowspace/test/test_generator.py

-from pypy.conftest import option
+from rpython.conftest import option
 from rpython.flowspace.objspace import FlowObjSpace
 from rpython.flowspace.model import Variable
 from rpython.flowspace.generator import (make_generatoriterator_class,

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 pypy import conftest
+from rpython.conftest import option
 from rpython.tool.stdlib_opcode import bytecode_spec, host_bytecode_spec
 
 import os
         return graph
 
     def show(self, graph):
-        if conftest.option.view:
+        if option.view:
             graph.show()
 
     def setup_class(cls):

rpython/jit/metainterp/compile.py

 from rpython.rlib.debug import debug_start, debug_stop, debug_print
 from rpython.rlib import rstack
 from rpython.rlib.jit import JitDebugInfo, Counters
-from pypy.conftest import option
+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

rpython/jit/metainterp/history.py

 from rpython.rlib.objectmodel import compute_unique_id
 from rpython.rlib.rarithmetic import r_int64, is_valid_int
 
-from pypy.conftest import option
+from rpython.conftest import option
 
 from rpython.jit.metainterp.resoperation import ResOperation, rop
 from rpython.jit.codewriter import heaptracker, longlong

rpython/jit/metainterp/test/support.py

     try:
         metainterp.compile_and_run_once(jitdriver_sd, *args)
     except DoneWithThisFrame, e:
-        #if conftest.option.view:
+        #if option.view:
         #    metainterp.stats.view()
         return e.args[0]
     else:

rpython/jit/metainterp/test/test_ajit.py

 
 import py
 
-from pypy import conftest
 from rpython.jit.codewriter import longlong
 from rpython.jit.codewriter.policy import JitPolicy, StopAtXPolicy
 from rpython.jit.metainterp import pyjitpl, history

rpython/jit/metainterp/test/test_memmgr.py

     # XXX we don't invokve py.test machinery but try to make sure
     # pypy support code sees the test options from the invoking 
     # process
-    import pypy.conftest
+    import rpython.conftest
     class opt:
         pass
-    pypy.conftest.option = opt()
-    pypy.conftest.option.__dict__.update(eval(sys.argv[3]))
+    rpython.conftest.option = opt()
+    rpython.conftest.option.__dict__.update(eval(sys.argv[3]))
 
 import py
 from rpython.jit.metainterp.memmgr import MemoryManager
         py.test.skip(
             "passing repr() to subprocess.Popen probably doesn't work")
     import os, subprocess
-    from pypy.conftest import option
+    from rpython.conftest import option
     thisfile = os.path.abspath(__file__)
     p = subprocess.Popen([sys.executable, thisfile,
                           '--sub', repr(sys.path), repr(option.__dict__)])

rpython/jit/tl/jittest.py

 only after the '---> Checkpoint' fork.
 """
 
-from pypy.conftest import option
+from rpython.conftest import option
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rtyper.llinterp import LLInterpreter
 from rpython.rtyper.annlowlevel import llstr

rpython/rlib/test/test_jit.py

 import py
 
-from pypy.conftest import option
+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)

rpython/rlib/test/test_nonconst.py

 
 from rpython.flowspace.objspace import FlowObjSpace
 from rpython.annotator.annrpython import RPythonAnnotator
-from pypy.conftest import option
+from rpython.conftest import option
 from rpython.annotator.model import SomeInstance
 
 def test_nonconst():

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 pypy.conftest import option
+from rpython.conftest import option
 
 def strange_key_eq(key1, key2):
     return key1[0] == key2[0]   # only the 1st character is relevant

rpython/rtyper/lltypesystem/ll2ctypes.py

     load_library_kwargs = {}
 
 import os, platform as host_platform
-from pypy import conftest
 from rpython.rtyper.lltypesystem import lltype, llmemory
 from rpython.rtyper.extfunc import ExtRegistryEntry
 from rpython.rlib.objectmodel import Symbolic, ComputedIntSymbolic

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 pypy.conftest import option
+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

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 pypy import conftest
+from rpython.conftest import option
 
 
 class A(object):
     t = interp.typer.annotator.translator
     t.config.translation.backendopt.constfold = True
     backend_optimizations(t)
-    if conftest.option.view:
+    if option.view:
         t.view()
 
     LLFrame = interp.frame_class

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 pypy import conftest
+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 conftest.option.view:
+    if option.view:
         t.view()
     if fptr:
         return fptr._obj.graph, t

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

 from rpython.translator.translator import TranslationContext, graphof
 from rpython.translator.exceptiontransform import ExceptionTransformer
 from rpython.rtyper.lltypesystem import lltype
-from pypy import conftest
+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 conftest.option.view:
+        if option.view:
             t.view()
         return llinterp, graph
 
     t.buildannotator().build_types(func, inputtypes)
     if specialize:
         t.buildrtyper().specialize()
-    if conftest.option.view:
+    if option.view:
         t.view()
     return t
 
     graphs_borrowed = {}
     for graph in t.graphs[:]:
         graphs_borrowed[graph] = transformer.transform_graph(graph)
-    if conftest.option.view:
+    if option.view:
         t.view()
     t.checkgraphs()
     if check:

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 pypy import conftest
+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 conftest.option.view:
+    if option.view:
         t.viewcg()
     return t
 
         db = cbuild.generate_graphs_for_llinterp()
         entrypointptr = cbuild.getentrypointptr()
         entrygraph = entrypointptr._obj.graph
-        if conftest.option.view:
+        if option.view:
             t.viewcg()
 
         cls.name_to_func = name_to_func

rpython/rtyper/ootypesystem/test/test_oortype.py

 import py
-from pypy import conftest
+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 conftest.option.view:
+    if viewBefore or option.view:
         t.view()
     t.buildrtyper(type_system="ootype").specialize()
-    if viewAfter or conftest.option.view:
+    if viewAfter or option.view:
         t.view()
     return graphof(t, f)
 
 
     t = TranslationContext()
     t.buildannotator().build_types(f, [])
-    if conftest.option.view:
+    if option.view:
         t.view()
     rtyper = t.buildrtyper(type_system="ootype")
     rtyper.specialize()

rpython/rtyper/test/test_llann.py

 import py
 
 from rpython.annotator import model as annmodel
-from pypy.conftest import option
+from rpython.conftest import option
 from rpython.flowspace.objspace import FlowObjSpace
 from rpython.rtyper.annlowlevel import (annotate_lowlevel_helper,
     MixLevelHelperAnnotator, PseudoHighLevelCallable, llhelper,

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 pypy import conftest
+from rpython.conftest import option
 
 
 # switch on logging of interp to show more info on failing tests

rpython/rtyper/test/test_rstr.py

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

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 pypy import conftest
+from rpython.conftest import option
 
 
 class V(object):

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 pypy import conftest
+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 conftest.option.view:
+        if option.view:
             t.view()
         backend_optimizations(t, **optflags)
-        if conftest.option.view:
+        if 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 conftest.option.view:
+        if option.view:
             later_graph.show()
         common_graph = graphof(t, common)
         found = False

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 pypy.conftest import option
+from rpython.conftest import option
 
 class BaseTestCanRaise(object):
     type_system = None

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 pypy import conftest
+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 conftest.option.view:
+    if option.view:
         t.view()
     return graph, t
 
 def check_graph(graph, args, expected_result, t):
-    if conftest.option.view:
+    if 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 conftest.option.view:
+    if 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 conftest.option.view:
+    if 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 conftest.option.view:
+    if 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'.

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 pypy import conftest
+from rpython.conftest import option
 
 def build_adi(function, types):
     t = Translation(function, types)
     t.rtype()
-    if conftest.option.view:
+    if option.view:
         t.view()
     adi = AbstractDataFlowInterpreter(t.context)
     graph = graphof(t.context, function)

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 pypy.conftest import option
+from rpython.conftest import option
 from rpython.rlib import rgc
 
 

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 pypy.conftest import option
+from rpython.conftest import option
 from rpython.translator.backendopt import removenoops
 from rpython.flowspace.model import summary
 

rpython/translator/backendopt/test/test_innerloop.py

 from rpython.translator.translator import TranslationContext
 from rpython.translator.backendopt.innerloop import find_inner_loops
-from pypy.conftest import option
+from rpython.conftest import option
 
 def test_simple_loop():
     def snippet_fn(x, y):

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 pypy.conftest import option
+from rpython.conftest import option
 
 class BaseMallocRemovalTest(object):
     type_system = None

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 pypy.conftest import option
+from rpython.conftest import option
 import sys
 
 from rpython.translator.backendopt.mallocprediction import *

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 pypy.conftest import option
+from rpython.conftest import option
 
 DONT_CHECK_RESULT = object()
 class CHECK_RAISES:

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 pypy import conftest
+from rpython.conftest import option
 
 import py
 log = py.log.Producer('test_backendoptimization')
                               constfold=False,
                               raisingop2direct_call=False)
     graph = graphof(t, fn)
-    if conftest.option.view:
+    if 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 conftest.option.view:
+    if option.view:
         t.view()
     check_graph(graph, [10, True], 75, t)
     ops = getops(graph_getsum)

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 pypy.conftest import option
+from rpython.conftest import option
 
 class TestStoreSink(object):
     # not sure if it makes any sense on ootype, maybe worth trying

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 pypy.conftest import option
+from rpython.conftest import option
 
 
 class BaseTest(object):

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 pypy import conftest
+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 conftest.option.view:
+        if option.view:
             t.view()
         exe_name = cbuilder.compile()
 

rpython/translator/c/test/test_backendoptimized.py

-from pypy import conftest
+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

rpython/translator/c/test/test_newgc.py

 
 import py
 
-from pypy import conftest
+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 conftest.option.view:
+        if option.view:
             t.viewcg()
         exename = t.compile()
 

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 pypy import conftest
+from rpython.conftest import option
 
 def compile_func(func, args):
     return compile(func, args, gcpolicy='ref')

rpython/translator/c/test/test_rtagged.py

 # only with Boehm so far
 
 from rpython.translator.interactive import Translation
-from pypy import conftest
+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 conftest.option.view:
+        if option.view:
             t.view()
     g = os.popen(exename, 'r')
     data = g.read()

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 pypy.conftest import option
+from rpython.conftest import option
 
 
 class StandaloneTests(object):

rpython/translator/c/test/test_symbolic.py

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

rpython/translator/cli/option.py

-from pypy.conftest import option
+from rpython.conftest import option
 
 _defaultopt = dict(wd = False, source = False, nostop = False, stdout = False)
 

rpython/translator/jvm/option.py

-from pypy.conftest import option
+from rpython.conftest import option
 
 # Not sure why this is needed.  Sure that it shouldn't be, even.
 _default_values = {

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 pypy.conftest import option
+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

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 pypy import conftest
+from rpython.conftest import option
 import sys
 
 def check_debug_build():
-    # the 'not conftest.option.view' is because debug builds rarely
+    # 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 conftest.option.view:
+    if not hasattr(sys, 'gettotalrefcount') and not 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 conftest.option.view:
+        if option.view:
             t.view()
         if backendopt:
             backend_optimizations(t)
         etrafo = exceptiontransform.ExceptionTransformer(t)
         etrafo.create_exception_handling(g)
         join_blocks(g)
-        if conftest.option.view:
+        if option.view:
             t.view()
         return t, g
 

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 pypy import conftest
+from rpython.conftest import option
 
 def translate(func, argtypes, backend_optimize=True):
     t = TranslationContext()
     t.buildrtyper().specialize()
     if backend_optimize:
         backend_optimizations(t)
-    if conftest.option.view:
+    if 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 conftest.option.view:
+        if 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 conftest.option.view:
+        if option.view:
             t.view()
         t.buildrtyper(self.typesystem).specialize()
         backend_optimizations(t)
-        if conftest.option.view:
+        if option.view:
             t.view()
         graph = graphof(t, func)
         interp = LLInterpreter(t.rtyper)

rpython/translator/test/test_stackcheck.py

-from pypy import conftest
+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 conftest.option.view:
+    if option.view:
         t.view()
     check(graphof(t, f), 'f')
 
     exctransf = t.getexceptiontransformer()
     f_graph = graphof(t, f)
     exctransf.create_exception_handling(f_graph)
-    if conftest.option.view:
+    if option.view:
         f_graph.show()
     check(f_graph, 'f')    
 
 
     gctransf = GCTransform(t)
     gctransf.transform_graph(f_graph)
-    if conftest.option.view:
+    if option.view:
         f_graph.show()
     relevant = check(f_graph, 'f')        
     for p in relevant: