Example #1
0
def run_tests(context,
              app=None,
              module=None,
              doctype=None,
              test=(),
              driver=None,
              profile=False):
    "Run tests"
    import frappe.test_runner
    from frappe.utils import sel
    tests = test

    site = get_single_site(context)
    frappe.init(site=site)

    if frappe.conf.run_selenium_tests and False:
        sel.start(context.verbose, driver)

    try:
        ret = frappe.test_runner.main(app,
                                      module,
                                      doctype,
                                      context.verbose,
                                      tests=tests,
                                      force=context.force,
                                      profile=profile)
        if len(ret.failures) == 0 and len(ret.errors) == 0:
            ret = 0
    finally:
        pass
        if frappe.conf.run_selenium_tests:
            sel.close()

    sys.exit(ret)
Example #2
0
def run_tests(app=None, module=None, doctype=None, verbose=False, tests=(), without_serve=False):
	import frappe.test_runner
	from frappe.utils import sel

	frappe.local.localhost = "http://localhost:8888"
	if not without_serve:
		pipe = subprocess.Popen(["frappe", frappe.local.site, "--serve", "--port", "8888"],
			stdout=subprocess.PIPE, stderr=subprocess.PIPE)
		while not pipe.stderr.readline():
			time.sleep(0.5)
		if verbose:
			print "Test server started"

	sel.start(verbose)

	ret = 1
	try:
		ret = frappe.test_runner.main(app and app[0], module and module[0], doctype and doctype[0], verbose,
			tests=tests)
		if len(ret.failures) == 0 and len(ret.errors) == 0:
			ret = 0
	finally:
		if not without_serve:
			pipe.terminate()

		sel.close()

	return ret
Example #3
0
def run_tests(context, app=None, module=None, doctype=None, test=(), driver=None, profile=False):
    "Run tests"
    import frappe.test_runner
    from frappe.utils import sel

    tests = test

    site = get_site(context)
    frappe.init(site=site)

    if frappe.conf.run_selenium_tests and False:
        sel.start(context.verbose, driver)

    try:
        ret = frappe.test_runner.main(
            app, module, doctype, context.verbose, tests=tests, force=context.force, profile=profile
        )
        if len(ret.failures) == 0 and len(ret.errors) == 0:
            ret = 0
    finally:
        pass
        if frappe.conf.run_selenium_tests:
            sel.close()

    sys.exit(ret)
Example #4
0
def run_tests(app=None,
              module=None,
              doctype=None,
              verbose=False,
              tests=(),
              driver=None,
              force=False):
    import frappe.test_runner
    from frappe.utils import sel

    sel.start(verbose, driver)

    ret = 1
    try:
        ret = frappe.test_runner.main(app and app[0],
                                      module and module[0],
                                      doctype and doctype[0],
                                      verbose,
                                      tests=tests,
                                      force=force)
        if len(ret.failures) == 0 and len(ret.errors) == 0:
            ret = 0
    finally:
        sel.close()

    return ret
Example #5
0
def run_tests(app=None, module=None, doctype=None, verbose=False, tests=(), driver=None, force=False):
	import frappe.test_runner
	from frappe.utils import sel

	sel.start(verbose, driver)

	ret = 1
	try:
		ret = frappe.test_runner.main(app and app[0], module and module[0], doctype and doctype[0], verbose,
			tests=tests, force=force)
		if len(ret.failures) == 0 and len(ret.errors) == 0:
			ret = 0
	finally:
		sel.close()

	return ret
Example #6
0
def start():
    try:
        run()
    finally:
        sel.close()
def start():
	try:
		run()
	finally:
		sel.close()