pkg5testenv.py revision 3049
49N/A# The contents of this file are subject to the terms of the 49N/A# Common Development and Distribution License (the "License"). 49N/A# You may not use this file except in compliance with the License. 49N/A# See the License for the specific language governing permissions 49N/A# and limitations under the License. 49N/A# When distributing Covered Code, include this CDDL HEADER in each 49N/A# If applicable, add the following below this CDDL HEADER, with the 49N/A# fields enclosed by brackets "[]" replaced with your own identifying 49N/A# information: Portions Copyright [yyyy] [name of copyright owner] 49N/A# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. 49N/A """ Set up environment for doing testing. 96N/A We set PYTHONPATH and PATH so that they reference the proto 222N/A area, and clear packaging related environment variables 49N/A (every variable prefixed with PKG_). 49N/A path_to_proto should be a relative path indicating a path 49N/A to proto area of the workspace. So, if your test case is 49N/A This function looks at argv[0] to compute the ultimate 49N/A path to the proto area; this is nice because you can then 96N/A invoke test cases like normal commands; i.e.: 96N/A If 'covdir' is provided, coverage will be started and the 96N/A related coverage object returned. 96N/A If 'system_test' is True, tests will run on live system. 96N/A print "Unable to determine appropriate proto area location." 96N/A print "This is a porting problem." 222N/A # Figure out from where we're invoking the command 222N/A # Clean up relative ../../, etc. out of path to proto 222N/A # Because subprocesses must also source from the proto area, 222N/A # we need to set PYTHONPATH in the environment as well as # Proxy environment variables cause all kinds of problems, strip them # Use "keys"; otherwise we'll change dictionary size during iteration. # Tell package manager where its application data files live. # Save off the value for tempdir when we were invoked, since the # suite will subsequently modify tempdir to sandbox test cases.