~cprov/uci-engine/1335753-glance-creds

« back to all changes in this revision

Viewing changes to ci-utils/ci_utils/testing/fixtures.py

  • Committer: Ubuntu CI Bot
  • Author(s): Vincent Ladeuil
  • Date: 2014-06-30 12:48:43 UTC
  • mfrom: (621.2.10 juju-env-detection)
  • Revision ID: ubuntu_ci_bot-20140630124843-czas2e6kxgqc9hm8
[r=PS Jenkins bot, Evan Dandrea] Detect juju type provider to better support lxc testing env.  from Vincent Ladeuil

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
15
import os
16
16
 
 
17
from ucitests import fixtures
 
18
 
17
19
from ci_utils import data_store
18
20
from ci_utils.json_status import LAST_REVISION
19
21
 
125
127
            fd.write(original_content)
126
128
 
127
129
    test.addCleanup(restore)
 
130
 
 
131
 
 
132
def isolate_from_juju_env(test):
 
133
    """Isolate a test from juju environment definitions.
 
134
 
 
135
    This is usually called in setUp for tests that want to modify the juju
 
136
    environement definitions and restore them after the test is run.
 
137
 
 
138
    :param test: A test instance.
 
139
    """
 
140
    # Juju environments are defined in ${JUJU_HOME}/environments.yaml and can
 
141
    # be specified via ${JUJU_ENV}
 
142
    fixtures.set_uniq_cwd(test)
 
143
    fixtures.isolate_from_env(
 
144
        test, dict(HOME=test.uniq_dir, JUJU_HOME='.', JUJU_ENV=None))