Exemplo n.º 1
0
else:
    print('INFO: VFS path finder already installed')

print('Testing VFS for .py files')

# Add VFS file URL at the beginning of import search path
vfs_url = __BRYTHON__.brython_path + '../tests/test.vfs.js'
sys.path.insert(0, vfs_url)

from hello import *

assert get_hello() == 'Hello from py'
assert world.get_world() == 'py world'

import foo
assert foo.get_foo() == 'foo from py'
assert foo.get_bar() == 'bar from py'

# Assertions for issue #7
import test_issue7  # brythontest2 in #7 => test_issue7
test_issue7.xxx = 123
assert test_issue7.xxx == 123
assert test_issue7.yyy() == 246

# Repeat tests for .pyc VFS file
print('Testing VFS for .pyc files')

# Override VFS entry in sys.path
vfs_pyc_url = __BRYTHON__.brython_path + '../tests/test_pyc.vfs.js'
sys.path[0] = vfs_pyc_url
Exemplo n.º 2
0
else:
    print('INFO: VFS path finder already installed')

print('Testing VFS for .py files')

# Add VFS file URL at the beginning of import search path
vfs_url = __BRYTHON__.brython_path + '../tests/test.vfs.js'
sys.path.insert(0, vfs_url)

from hello import *

assert get_hello() == 'Hello from py'
assert world.get_world() == 'py world'

import foo
assert foo.get_foo() == 'foo from py'
assert foo.get_bar() == 'bar from py'

# Assertions for issue #7
import test_issue7 # brythontest2 in #7 => test_issue7
test_issue7.xxx = 123
assert test_issue7.xxx == 123
assert test_issue7.yyy() == 246

# Repeat tests for .pyc VFS file
print('Testing VFS for .pyc files')

# Override VFS entry in sys.path
vfs_pyc_url = __BRYTHON__.brython_path + '../tests/test_pyc.vfs.js'
sys.path[0] = vfs_pyc_url
Exemplo n.º 3
0
def get_indirect():
    return foo.get_foo() + ' and bar'
Exemplo n.º 4
0
def get_direct():
    return get_foo() + ' and bar'
Exemplo n.º 5
0
def get_internal():
    from foo import get_foo
    return get_foo() + ' and bar'