コード例 #1
0
ファイル: context.py プロジェクト: AntonTimiskov/Riurik
def patch(path, ctx, riurik_url):
	ctximpl = contrib.context_impl(ctx.items())
	if not ctximpl.has(settings.INCLUDE_KEY):
		exclude = []
		if ctximpl.has(settings.EXCLUDE_KEY):
			exclude = contrib.loadListFromString(ctx.get( option=settings.EXCLUDE_KEY ))
		include = []
		for root, dirs, files in os.walk(ctx.get_folder()):
			for file_ in files:
				if re.match('^.*\.js$', file_):
					if file_ in exclude or settings.TEST_CONTEXT_JS_FILE_NAME in file_:
						continue
					file_abspath = os.path.abspath(os.path.join(root, file_))
					file_relpath = file_abspath.replace(os.path.abspath(ctx.get_folder()), '').lstrip('/').lstrip('\\')
					include += [ str(file_relpath) ]
	else:
		include = contrib.loadListFromString(ctx.get( option=settings.INCLUDE_KEY ))

	ctximpl.replace(settings.INCLUDE_KEY, str(include).replace('\'','\"'))

	patch_libraries(path, ctximpl, ctx)
	add_start_time(ctximpl)
	contrib.patch_host_port(ctximpl, riurik_url)

	return ctximpl.as_tuple()
コード例 #2
0
ファイル: context.py プロジェクト: andrew-malkov/Riurik
def patch(path, ctx, riurik_url, ctxname=None):
	ctximpl = contrib.context_impl(ctx.items())
	include_tests(path, ctx, ctximpl)
	patch_libraries(path, ctximpl, ctx)
	add_start_time(ctximpl)
	add_name(ctximpl, ctxname)
	add_virtual_root(ctximpl, path)
	contrib.patch_host_port(ctximpl, riurik_url)

	return ctximpl.as_tuple()