Esempio n. 1
0
def test_rpystone():
    space = Space()
    modic = init(space)
    entry = space.getitem(modic, space.wrap("entrypoint"))
    # warm-up,to get everything translated
    space.call(entry, space.newtuple([space.wrap(-1)]))
    # now this is the real one
    space.call(entry, space.newtuple([space.wrap(LOOPS)]))
Esempio n. 2
0
def test_rpystone():
    space = Space()
    modic = init(space)
    entry = space.getitem(modic, space.wrap("entrypoint"))
    # warm-up,to get everything translated
    space.call(entry, space.newtuple([space.wrap(-1)]))
    # now this is the real one
    space.call(entry, space.newtuple([space.wrap(LOOPS)]))
Esempio n. 3
0
def test_nanos():
    space = Space()
    # manually imports app_main.py
    filename = os.path.join(this_dir, 'app_main.py')
    w_dict = space.newdict()
    space.exec_(open(filename).read(), w_dict, w_dict)
    entry_point = create_entry_point(space, w_dict)

    # check that 'os' is not in sys.modules
    assert not space.is_true(
        space.call_method(space.sys.get('modules'),
                          '__contains__', space.wrap('os')))
    # But that 'sys' is still present
    assert space.is_true(
        space.call_method(space.sys.get('modules'),
                          '__contains__', space.wrap('sys')))

    entry_point(['', '-c', 'print 42'])
Esempio n. 4
0
def test_nanos():
    space = Space()
    # manually imports app_main.py
    filename = os.path.join(this_dir, 'app_main.py')
    w_dict = space.newdict()
    space.exec_(open(filename).read(), w_dict, w_dict)
    entry_point = create_entry_point(space, w_dict)

    # check that 'os' is not in sys.modules
    assert not space.is_true(
        space.call_method(space.sys.get('modules'), '__contains__',
                          space.wrap('os')))
    # But that 'sys' is still present
    assert space.is_true(
        space.call_method(space.sys.get('modules'), '__contains__',
                          space.wrap('sys')))

    entry_point(['', '-c', 'print 42'])