From 1686480f454eb6855810b69c0f9484233ba15313 Mon Sep 17 00:00:00 2001 From: "cduvall@chromium.org" Date: Tue, 11 Sep 2012 17:38:57 +0000 Subject: Extensions Docs Server: Fix tests so they work from any directory Tests now can be run from any directory. Review URL: https://chromiumcodereview.appspot.com/10916217 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156043 0039d316-1c4b-4281-b951-d872f2087c98 --- tools/json_schema_compiler/idl_schema.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tools/json_schema_compiler') diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py index 393887b..6693ed4 100644 --- a/tools/json_schema_compiler/idl_schema.py +++ b/tools/json_schema_compiler/idl_schema.py @@ -20,11 +20,16 @@ import schema_util # idl_parser expects to be able to import certain files in its directory, # so let's set things up the way it wants. -idl_generators_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), - os.pardir, os.pardir, 'ppapi', 'generators') -if idl_generators_path not in sys.path: - sys.path.insert(0, idl_generators_path) -import idl_parser +_idl_generators_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), + os.pardir, os.pardir, 'ppapi', 'generators') +if _idl_generators_path in sys.path: + import idl_parser +else: + sys.path.insert(0, _idl_generators_path) + try: + import idl_parser + finally: + sys.path.pop(0) def ProcessComment(comment): ''' -- cgit v1.1