Beispiel #1
0
def test_parse_new_format():
    assert (parse_info("[foo]\n" "    bar = True\n") == {'foo.bar': True})

    assert (parse_info("[objspace]\n"
                       "    x = 'hello'\n"
                       "[translation]\n"
                       "    bar = 42\n"
                       "    [egg]\n"
                       "        something = None\n"
                       "    foo = True\n") == {
                           'translation.foo': True,
                           'translation.bar': 42,
                           'translation.egg.something': None,
                           'objspace.x': 'hello',
                       })

    assert parse_info("simple = 43\n") == {'simple': 43}
Beispiel #2
0
def test_parse_new_format():
    assert (parse_info("[foo]\n"
                       "    bar = True\n")
            == {'foo.bar': True})
    
    assert (parse_info("[objspace]\n"
                       "    x = 'hello'\n"
                       "[translation]\n"
                       "    bar = 42\n"
                       "    [egg]\n"
                       "        something = None\n"
                       "    foo = True\n")
            == {
        'translation.foo': True,
        'translation.bar': 42,
        'translation.egg.something': None,
        'objspace.x': 'hello',
        })

    assert parse_info("simple = 43\n") == {'simple': 43}
Beispiel #3
0
def test_parse_old_format():
    assert (parse_info("                          objspace.allworkingmodules: True\n"
                       "                    objspace.disable_call_speedhacks: False\n"
                       "                                 objspace.extmodules: None\n"
                       "                        objspace.std.prebuiltintfrom: -5\n")
            == {
        'objspace.allworkingmodules': True,
        'objspace.disable_call_speedhacks': False,
        'objspace.extmodules': None,
        'objspace.std.prebuiltintfrom': -5,
        })
Beispiel #4
0
def test_parse_old_format():
    assert (parse_info(
        "                          objspace.allworkingmodules: True\n"
        "                    objspace.disable_call_speedhacks: False\n"
        "                                 objspace.extmodules: None\n"
        "                        objspace.std.prebuiltintfrom: -5\n") == {
            'objspace.allworkingmodules': True,
            'objspace.disable_call_speedhacks': False,
            'objspace.extmodules': None,
            'objspace.std.prebuiltintfrom': -5,
        })
Beispiel #5
0
    def getinvocation(self, regrtest):
        fspath = regrtest.getfspath()
        python = sys.executable
        pypy_script = pypydir.join('bin', 'pyinteractive.py')
        alarm_script = pypydir.join('tool', 'alarm.py')
        if sys.platform == 'win32':
            watchdog_name = 'watchdog_nt.py'
        else:
            watchdog_name = 'watchdog.py'
        watchdog_script = rpythondir.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