Exemple #1
0
    def getinvocation(self, regrtest):
        fspath = regrtest.getfspath()
        python = sys.executable
        pypy_script = pypydir.join('bin', 'py.py')
        alarm_script = pypydir.join('tool', 'alarm.py')
        if sys.platform == 'win32':
            watchdog_name = 'watchdog_nt.py'
        else:
            watchdog_name = 'watchdog.py'
        watchdog_script = pypydir.join('tool', watchdog_name)

        regr_script = pypydir.join('tool', 'pytest', 'run-script',
                                   'regrverbose.py')

        # we use the regrverbose script to run the test, but don't get
        # confused: it still doesn't set verbose to True by default if
        # regrtest.outputpath() is true, because output tests get confused
        # in verbose mode.  You can always force verbose mode by passing
        # the -v option to py.test.  The regrverbose script contains the
        # logic that CPython uses in its regrtest.py.
        regrrun = str(regr_script)
        if not regrtest.getoutputpath() or pypy_option.verbose:
            regrrun_verbosity = '1'
        else:
            regrrun_verbosity = '0'

        TIMEOUT = gettimeout()
        if option.pypy:
            execpath = py.path.local(option.pypy)
            if not execpath.check():
                execpath = py.path.local.sysfind(option.pypy)
            if not execpath:
                raise LookupError("could not find executable %r" %
                                  (option.pypy, ))

            # check modules
            info = py.process.cmdexec("%s --info" % execpath)
            for mod in regrtest.usemodules:
                if "objspace.usemodules.%s: False" % mod in info:
                    py.test.skip("%s module not included in %s" %
                                 (mod, execpath))

            cmd = "%s %s %s %s" % (execpath, regrrun, regrrun_verbosity,
                                   fspath.purebasename)

            # add watchdog for timing out
            cmd = "%s %s %s %s" % (python, watchdog_script, TIMEOUT, cmd)
        else:
            pypy_options = []
            pypy_options.extend(
                ['--withmod-%s' % mod for mod in regrtest.usemodules])
            sopt = " ".join(pypy_options)

            cmd = "%s %s %d %s %s %s %s %s" % (
                python, alarm_script, TIMEOUT, pypy_script, sopt, regrrun,
                regrrun_verbosity, fspath.purebasename)
        return cmd
Exemple #2
0
    def getinvocation(self, regrtest): 
        fspath = regrtest.getfspath() 
        python = sys.executable 
        pypy_script = pypydir.join('bin', 'py.py')
        alarm_script = pypydir.join('tool', 'alarm.py')
        if sys.platform == 'win32':
            watchdog_name = 'watchdog_nt.py'
        else:
            watchdog_name = 'watchdog.py'
        watchdog_script = pypydir.join('tool', watchdog_name)

        regr_script = pypydir.join('tool', 'pytest', 
                                   'run-script', 'regrverbose.py')
        
        pypy_options = []
        pypy_options.extend(
            ['--withmod-%s' % mod for mod in regrtest.usemodules])
        sopt = " ".join(pypy_options) 
        # we use the regrverbose script to run the test, but don't get
        # confused: it still doesn't set verbose to True by default if
        # regrtest.outputpath() is true, because output tests get confused
        # in verbose mode.  You can always force verbose mode by passing
        # the -v option to py.test.  The regrverbose script contains the
        # logic that CPython uses in its regrtest.py.
        regrrun = str(regr_script)
        if not regrtest.getoutputpath() or pypy_option.verbose:
            regrrun_verbosity = '1'
        else:
            regrrun_verbosity = '0'
        
        TIMEOUT = gettimeout()
        if option.pypy:
            execpath = py.path.local(option.pypy)
            if not execpath.check():
                execpath = py.path.local.sysfind(option.pypy)
            if not execpath:
                raise LookupError("could not find executable %r" %(option.pypy,))
            cmd = "%s %s %s %s" %(
                execpath, 
                regrrun, regrrun_verbosity, fspath.purebasename)

            # add watchdog for timing out
            cmd = "%s %s %s %s" %(
                python, watchdog_script, TIMEOUT,
                cmd)
        else:
            cmd = "%s %s %d %s %s %s %s %s" %(
                python, alarm_script, TIMEOUT, 
                pypy_script, sopt, 
                regrrun, regrrun_verbosity, fspath.purebasename)
        return cmd 
Exemple #3
0
    def getinvocation(self, regrtest): 
        fspath = regrtest.getfspath() 
        python = sys.executable 
        pypy_script = pypydir.join('bin', 'py.py')
        alarm_script = pypydir.join('tool', 'alarm.py')
        if sys.platform == 'win32':
            watchdog_name = 'watchdog_nt.py'
        else:
            watchdog_name = 'watchdog.py'
        watchdog_script = pypydir.join('tool', watchdog_name)

        regr_script = pypydir.join('tool', 'pytest', 
                                   'run-script', 'regrverbose.py')
        
        regrrun = str(regr_script)
        option = self.config.option
        TIMEOUT = gettimeout(option.timeout.lower())
        if option.pypy:
            execpath = py.path.local(option.pypy)
            if not execpath.check():
                execpath = py.path.local.sysfind(option.pypy)
            if not execpath:
                raise LookupError("could not find executable %r" %
                                  (option.pypy,))

            # check modules
            info = py.process.cmdexec("%s --info" % execpath)
            info = parse_info(info)
            for mod in regrtest.usemodules:
                if info.get('objspace.usemodules.%s' % mod) is not True:
                    py.test.skip("%s module not included in %s" % (mod,
                                                                   execpath))
                    
            cmd = "%s %s %s" %(
                execpath, 
                regrrun, fspath.purebasename)

            # add watchdog for timing out
            cmd = "%s %s %s %s" %(
                python, watchdog_script, TIMEOUT,
                cmd)
        else:
            pypy_options = []
            pypy_options.extend(
                ['--withmod-%s' % mod for mod in regrtest.usemodules])
            sopt = " ".join(pypy_options) 
            cmd = "%s %s %d %s -S %s %s %s -v" %(
                python, alarm_script, TIMEOUT, 
                pypy_script, sopt, 
                regrrun, fspath.purebasename)
        return cmd 
Exemple #4
0
    def getinvocation(self, regrtest): 
        fspath = regrtest.getfspath() 
        python = sys.executable 
        pypy_script = pypydir.join('bin', 'py.py')
        alarm_script = pypydir.join('tool', 'alarm.py')
        watchdog_script = pypydir.join('tool', 'watchdog.py')

        regr_script = pypydir.join('tool', 'pytest', 
                                   'run-script', 'regrverbose.py')
        
        if option.use_compiled:
            execpath, info = getexecutable()        
        pypy_options = []
        if regrtest.oldstyle: 
            if (option.use_compiled and
                not info.get('objspace.std.oldstyle', False)):
                py.test.skip("old-style classes not available with this pypy-c")
            pypy_options.append('--oldstyle') 
        if regrtest.compiler:
            pypy_options.append('--compiler=%s' % regrtest.compiler)
        pypy_options.extend(
            ['--withmod-%s' % mod for mod in regrtest.usemodules])
        sopt = " ".join(pypy_options) 
        # we use the regrverbose script to run the test, but don't get
        # confused: it still doesn't set verbose to True by default if
        # regrtest.outputpath() is true, because output tests get confused
        # in verbose mode.  You can always force verbose mode by passing
        # the -v option to py.test.  The regrverbose script contains the
        # logic that CPython uses in its regrtest.py.
        regrrun = str(regr_script)
        if not regrtest.getoutputpath() or pypy_option.verbose:
            regrrun_verbosity = '1'
        else:
            regrrun_verbosity = '0'
        
        TIMEOUT = gettimeout()
        if option.use_compiled:
            cmd = "%s %s %s %s" %(
                execpath, 
                regrrun, regrrun_verbosity, fspath.purebasename)
            if sys.platform != 'win32':
                cmd = "%s %s %s %s" %(
                       python, watchdog_script, TIMEOUT,
                       cmd)
        else:
            cmd = "%s %s %d %s %s %s %s %s" %(
                python, alarm_script, TIMEOUT, 
                pypy_script, sopt, 
                regrrun, regrrun_verbosity, fspath.purebasename)
        return cmd 
Exemple #5
0
    def getinvocation(self, regrtest): 
        fspath = regrtest.getfspath() 
        python = sys.executable 
        pypy_script = pypydir.join('bin', 'py.py')
        alarm_script = pypydir.join('tool', 'alarm.py')
        if sys.platform == 'win32':
            watchdog_name = 'watchdog_nt.py'
        else:
            watchdog_name = 'watchdog.py'
        watchdog_script = pypydir.join('tool', watchdog_name)

        regr_script = pypydir.join('tool', 'pytest', 
                                   'run-script', 'regrverbose.py')
        
        regrrun = str(regr_script)
        option = self.config.option
        TIMEOUT = gettimeout(option.timeout.lower())
        if option.pypy:
            execpath = py.path.local(option.pypy)
            if not execpath.check():
                execpath = py.path.local.sysfind(option.pypy)
            if not execpath:
                raise LookupError("could not find executable %r" %
                                  (option.pypy,))

            # check modules
            info = py.process.cmdexec("%s --info" % execpath)
            for mod in regrtest.usemodules:
                if "objspace.usemodules.%s: False" % mod in info:
                    py.test.skip("%s module not included in %s" % (mod,
                                                                   execpath))
                    
            cmd = "%s %s %s" %(
                execpath, 
                regrrun, fspath.purebasename)

            # add watchdog for timing out
            cmd = "%s %s %s %s" %(
                python, watchdog_script, TIMEOUT,
                cmd)
        else:
            pypy_options = []
            pypy_options.extend(
                ['--withmod-%s' % mod for mod in regrtest.usemodules])
            sopt = " ".join(pypy_options) 
            cmd = "%s %s %d %s -S %s %s %s -v" %(
                python, alarm_script, TIMEOUT, 
                pypy_script, sopt, 
                regrrun, fspath.purebasename)
        return cmd 
Exemple #6
0
    def getinvocation(self, regrtest):
        fspath = regrtest.getfspath()
        python = sys.executable
        pypy_script = pypydir.join("bin", "py.py")
        alarm_script = pypydir.join("tool", "alarm.py")
        if sys.platform == "win32":
            watchdog_name = "watchdog_nt.py"
        else:
            watchdog_name = "watchdog.py"
        watchdog_script = pypydir.join("tool", watchdog_name)

        regr_script = pypydir.join("tool", "pytest", "run-script", "regrverbose.py")

        regrrun = str(regr_script)
        option = self.config.option
        TIMEOUT = gettimeout(option.timeout.lower())
        if option.pypy:
            execpath = py.path.local(option.pypy)
            if not execpath.check():
                execpath = py.path.local.sysfind(option.pypy)
            if not execpath:
                raise LookupError("could not find executable %r" % (option.pypy,))

            # check modules
            info = py.process.cmdexec("%s --info" % execpath)
            for mod in regrtest.usemodules:
                if "objspace.usemodules.%s: False" % mod in info:
                    py.test.skip("%s module not included in %s" % (mod, execpath))

            cmd = "%s %s %s" % (execpath, regrrun, fspath.purebasename)

            # add watchdog for timing out
            cmd = "%s %s %s %s" % (python, watchdog_script, TIMEOUT, cmd)
        else:
            pypy_options = []
            pypy_options.extend(["--withmod-%s" % mod for mod in regrtest.usemodules])
            sopt = " ".join(pypy_options)
            cmd = "%s %s %d %s -S %s %s %s -v" % (
                python,
                alarm_script,
                TIMEOUT,
                pypy_script,
                sopt,
                regrrun,
                fspath.purebasename,
            )
        return cmd
Exemple #7
0
from pypy.interpreter.gateway import ApplevelClass 
from pypy.interpreter.error import OperationError
from pypy.interpreter.module import Module as PyPyModule 
from pypy.interpreter.main import run_string, run_file

# the following adds command line options as a side effect! 
from pypy.conftest import gettestobjspace, option as pypy_option 
from test.regrtest import reportdiff
from test import pystone

from pypy.tool.pytest import appsupport 
from pypy.tool.pytest.confpath import pypydir, libpythondir, \
                                      regrtestdir, modregrtestdir, testresultdir
from pypy.tool.pytest.result import Result, ResultFromMime

pypyexecpath = pypydir.join('bin', 'pypy-c')

dist_rsync_roots = ['.', '../pypy', '../py']
    
# 
# Interfacing/Integrating with py.test's collection process 
#

# XXX no nice way to implement a --listpassing py.test option?! 
#option = py.test.addoptions("compliance testing options", 
#    py.test.Option('-L', '--listpassing', action="store", default=None, 
#                   type="string", dest="listpassing", 
#                   help="just display the list of expected-to-pass tests.")

Option = py.test.config.Option 
option = py.test.config.addoptions("compliance testing options",