~niedbalski/charms/trusty/rabbitmq-server/fix-lp-1489053

« back to all changes in this revision

Viewing changes to tests/charmhelpers/__init__.py

  • Committer: Liam Young
  • Date: 2015-09-09 13:12:47 UTC
  • mfrom: (110.1.4 rabbitmq-server)
  • Revision ID: liam.young@canonical.com-20150909131247-16hxw74o91c57kpg
[1chb1n, r=gnuoy] Refactor amulet tests, deprecate old tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2014-2015 Canonical Limited.
 
2
#
 
3
# This file is part of charm-helpers.
 
4
#
 
5
# charm-helpers is free software: you can redistribute it and/or modify
 
6
# it under the terms of the GNU Lesser General Public License version 3 as
 
7
# published by the Free Software Foundation.
 
8
#
 
9
# charm-helpers is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU Lesser General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU Lesser General Public License
 
15
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
 
16
 
 
17
# Bootstrap charm-helpers, installing its dependencies if necessary using
 
18
# only standard libraries.
 
19
import subprocess
 
20
import sys
 
21
 
 
22
try:
 
23
    import six  # flake8: noqa
 
24
except ImportError:
 
25
    if sys.version_info.major == 2:
 
26
        subprocess.check_call(['apt-get', 'install', '-y', 'python-six'])
 
27
    else:
 
28
        subprocess.check_call(['apt-get', 'install', '-y', 'python3-six'])
 
29
    import six  # flake8: noqa
 
30
 
 
31
try:
 
32
    import yaml  # flake8: noqa
 
33
except ImportError:
 
34
    if sys.version_info.major == 2:
 
35
        subprocess.check_call(['apt-get', 'install', '-y', 'python-yaml'])
 
36
    else:
 
37
        subprocess.check_call(['apt-get', 'install', '-y', 'python3-yaml'])
 
38
    import yaml  # flake8: noqa