Exemplo n.º 1
0
def notrailtester(runtime, n=4):

    html_filename = os.path.join(tempfile.gettempdir(),
                                 'flexx_empty_page.html')
    with open(html_filename, 'wb') as f:
        f.write('<html><body>test page</body></html>'.encode())

    # Give a chance for common stuff to init
    x = webruntime.launch(html_filename, runtime)
    time.sleep(0.5)
    x.close()

    before = index()

    for i in range(n):
        x = webruntime.launch(html_filename, runtime)
        time.sleep(1.5)
        x.close()
        time.sleep(0.5)

    after = index()

    extra_files = after.difference(before)
    extra_files2 = [
        f for f in extra_files
        if not f.startswith((webruntime.TEMP_APP_DIR, webruntime.RUNTIME_DIR))
    ]

    print(extra_files2)
    assert len(extra_files2) < n
Exemplo n.º 2
0
def notrailtester(runtime, n=4):
    
    html_filename = os.path.join(tempfile.gettempdir(), 'flexx_empty_page.html')
    with open(html_filename, 'wb') as f:
        f.write('<html><body>test page</body></html>'.encode())
    
    # Give a chance for common stuff to init
    x = webruntime.launch(html_filename, runtime)
    time.sleep(0.5)
    x.close()

    before = index()
    
    for i in range(n):
        x = webruntime.launch(html_filename, runtime)
        time.sleep(1.5)
        x.close()
        time.sleep(0.5)
    
    after = index()
    
    extra_files = after.difference(before)
    extra_files2 = [f for f in extra_files
                    if not f.startswith((webruntime.TEMP_APP_DIR,
                                         webruntime.RUNTIME_DIR))]
    
    print(extra_files2)
    assert len(extra_files2) < n
Exemplo n.º 3
0
def test_selenium():
    p = launch(URL, 'selenium-firefox')
    assert p._proc is None
    assert p.driver
    time.sleep(0.5)
    p.close()
    pytest.raises(ValueError, launch, URL, 'selenium')
Exemplo n.º 4
0
def test_selenium():
    p = launch(URL, 'selenium-firefox')
    assert p._proc is None
    assert p.driver
    time.sleep(0.5)
    p.close()
    pytest.raises(ValueError, launch, URL, 'selenium')
Exemplo n.º 5
0
def test_selenium():
    p = launch(URL, "selenium-firefox")
    assert p._proc is None
    assert p.driver
    p.close()

    pytest.raises(ValueError, launch, URL, "selenium")
Exemplo n.º 6
0
    def __init__(self, runtime='xul'):
        #BaseWidget.__init__(self, None)
        # Init websocket, will be set when a connection is made
        self._ws = None
        # Init runtime that is connected with this app instance
        self._runtime = None

        # Init
        self._widget_counter = 0
        self._children = []

        # While the client is not connected, we keep a queue of
        # commands, which are send to the client as soon as it connects
        self._pending_commands = []

        # Register this app instance
        if runtime == '<export>':
            self._ws = Exporter(self)
            self.init()
        elif runtime == 'notebook':
            manager._add_pending_app_instance(self)
        elif runtime:
            manager._add_pending_app_instance(self)
            init_server()
            host, port = _tornado_app.serving_at
            # We associate the runtime with this specific app instance by
            # including the app id to the url. In this way, it is pretty
            # much guaranteed that the runtime will connect to *this* app.
            icon = self._config.icon
            icon = icon if icon.image_sizes() else None
            name = self.name + '-' + self.id
            self._runtime = launch('http://%s:%i/%s/' % (host, port, name),
                                   runtime=runtime,
                                   size=self.config.size,
                                   icon=icon,
                                   title=self.config.title)
        print('Instantiate app %s' % self.__class__.__name__)
Exemplo n.º 7
0
 def __init__(self, runtime='xul'):
     #BaseWidget.__init__(self, None)
     # Init websocket, will be set when a connection is made
     self._ws = None
     # Init runtime that is connected with this app instance
     self._runtime = None
     
     # Init
     self._widget_counter = 0
     self._children = []
     
     # While the client is not connected, we keep a queue of
     # commands, which are send to the client as soon as it connects
     self._pending_commands = []
     
     # Register this app instance
     if runtime == '<export>':
         self._ws = Exporter(self)
         self.init()
     elif runtime == 'notebook':
         manager._add_pending_app_instance(self)
     elif runtime:
         manager._add_pending_app_instance(self)
         init_server()
         host, port = _tornado_app.serving_at
         # We associate the runtime with this specific app instance by
         # including the app id to the url. In this way, it is pretty
         # much guaranteed that the runtime will connect to *this* app.
         icon = self._config.icon
         icon = icon if icon.image_sizes() else None
         name = self.name + '-' + self.id
         self._runtime = launch('http://%s:%i/%s/' % (host, port, name), 
                                runtime=runtime, 
                                size=self.config.size,
                                icon=icon, title=self.config.title)
     print('Instantiate app %s' % self.__class__.__name__)
Exemplo n.º 8
0
def test_xul():
    p = launch(URL, 'xul')
    assert p._proc

    p.close()
    p.close()  # should do no harm
Exemplo n.º 9
0
def test_qtwebkit():
    p = launch(URL, 'pyqt')
    assert p._proc
    p.close()
Exemplo n.º 10
0
def test_default():
    p = launch(URL)
    assert p.__class__.__name__ == 'XulRuntime'
    p.close()
Exemplo n.º 11
0
def test_browser_fallback():
    p = launch(URL, 'browser-foo')
    assert p._proc is None
Exemplo n.º 12
0
def test_qtwebkit():
    p = launch(URL, 'pyqt')
    assert p._proc
    p.close()
Exemplo n.º 13
0
def test_xul():
    p = launch(URL, 'firefox-app')
    assert p._proc

    p.close()
    p.close()  # should do no harm
Exemplo n.º 14
0
def test_browser_ff():
    p = launch(URL, 'browser-firefox')
    assert p._proc is None
Exemplo n.º 15
0
def test_qtwebkit():
    p = launch('http://google.com', 'pyqt')
    assert p._proc
    p.close()
Exemplo n.º 16
0
def test_nwjs():
    p = launch(URL, 'nwjs')
    assert p._proc
    p.close()
Exemplo n.º 17
0
def test_nodejs():
    code = 'console.log("hello!")'
    p = launch(URL, 'nodejs', code=code)
    assert p._proc
    p.close()
Exemplo n.º 18
0
def test_qtwebkit():
    p = launch('http://google.com', 'pyqt')
    assert p._proc
    p.close()
Exemplo n.º 19
0
def test_nwjs():
    p = launch(URL, "nwjs")
    assert p._proc
    p.close()
Exemplo n.º 20
0
def test_xul():
    p = launch(URL, 'firefox-app')
    assert p._proc

    p.close()
    p.close()  # should do no harm
Exemplo n.º 21
0
def test_browser():
    p = launch(URL, "browser")
    assert p._proc is None
Exemplo n.º 22
0
from flexx.webruntime import launch

# Define icon
icon = None
#icondir = r'C:\almar\iep\iep\resources\appicons/'
#icondir = '/home/almar/projects/pyapps/iep/default/iep/resources/appicons/'
#icondir = '/Users/almar/py/iep/iep/resources/appicons/'
#icon = icondir + 'ieplogo.ico'


#target = 'file:///home/almar/projects/pylib/flexx/flexx/exp/learn_html5.html'
target = 'http://python.org'

rt1 = launch(target, 'xul', title='my xul app', icon=icon)
#rt2 = launch('http://python.org')
Exemplo n.º 23
0
def test_chomeapp():
    p = launch(URL, 'chromeapp')
    assert p._proc
    p.close()
Exemplo n.º 24
0
def test_nwjs():
    p = launch(URL, 'nwjs')
    assert p._proc
    p.close()
Exemplo n.º 25
0
def test_browser():
    p = launch(URL, 'browser')
    assert p._proc is None
Exemplo n.º 26
0
def test_chomeapp():
    p = launch(URL, 'chromeapp')
    assert p._proc
    p.close()
Exemplo n.º 27
0
def test_browser_fallback():
    p = launch(URL, 'browser-foo')
    assert p._proc is None
Exemplo n.º 28
0
def test_nodejs():
    code = 'console.log("hello!")'
    p = launch(URL, 'nodejs', code=code)
    assert p._proc
    p.close()
Exemplo n.º 29
0
def test_default():
    p = launch(URL)
    assert p.__class__.__name__ == 'XulRuntime'
    p.close()
Exemplo n.º 30
0
def test_browser():
    p = launch(URL, 'browser')
    assert p._proc is None
Exemplo n.º 31
0
def test_xul():
    p = launch(URL, 'xul')
    assert p._proc

    p.close()
    p.close()  # should do no harm
Exemplo n.º 32
0
def test_browser_ff():
    p = launch(URL, 'browser-firefox')
    assert p._proc is None