Exemplo n.º 1
0
def run_application(testapp, *args, **kw):
    cwd = os.path.join(here, 'apps', testapp)
    application_file = 'application.py'
    args = ('python', application_file) + args
    env.clear()
    kw.setdefault('cwd', cwd)
    result = env.run(*args, **kw)
    return result
Exemplo n.º 2
0
 def check_command(self,
                   projname,
                   template,
                   file_count,
                   look_for,
                   expect_stderr=False):
     res = env.run('pip',
                   'uninstall',
                   projname,
                   '-y',
                   expect_error=True)
     assert not res.stdout
     if template is not None:
         result = run_blazeweb('project',
                               '-t',
                               template,
                               '--no-interactive',
                               projname,
                               expect_stderr=is_win)
     else:
         result = run_blazeweb('project',
                               '--no-interactive',
                               projname,
                               expect_stderr=is_win)
     eq_(len(result.files_created), file_count)
     setup_args = ['python', 'setup.py', 'develop']
     if is_win:
         # running setup.py on the new project causes the .exe scripts to be
         # recreated.  This includes the nosetests.exe file.  But in windows
         # we are using that file to run the tests that are running this code
         # and that causes a permission denied error.  Therefore, we need to
         # prevent the setup.py develop command from checking dependencies.
         setup_args.append('-N')
     env.run(cwd=os.path.join(script_test_path, projname + '-dist'),
             expect_stderr=expect_stderr,
             *setup_args)
     res = env.run(projname)
     script_name = '%s-script.py' % projname if is_win else projname
     assert 'Usage: %s [global_options]' % script_name in res.stdout, res.stdout
     res = env.run(projname, 'testrun')
     assert '200 OK' in res.stdout
     assert 'Content-Type: text/html' in res.stdout
     indexstr = '\n%s\n' % look_for
     assert indexstr in res.stdout
     res = env.run('pip',
                   'uninstall',
                   projname,
                   '-y',
                   expect_stderr=True)
     assert 'Successfully uninstalled' in res.stdout.replace(
         '\r\n', '\n'), res.stdout
     env.clear()
Exemplo n.º 3
0
def run_blazeweb(*args, **kw):
    args = ('bw', ) + args
    env.clear()
    result = env.run(*args, **kw)
    return result