Skip to content

Commit

Permalink
tests: don't test git or aws if required modules are too old or not i…
Browse files Browse the repository at this point in the history
…nstalled
  • Loading branch information
saaros committed Jan 15, 2015
1 parent e3e9d3b commit 33dc22c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion poni/cloud_aws.py
Expand Up @@ -38,8 +38,10 @@
import boto.ec2.blockdevicemapping
import boto.exception
import boto.vpc
boto_is_current = LooseVersion(boto.Version) >= BOTO_REQUIREMENT
except ImportError:
boto = None
boto_is_current = False


def convert_boto_errors(method):
Expand Down Expand Up @@ -314,7 +316,7 @@ def get_provider_key(cls, cloud_prop):

def __init__(self, cloud_prop):
assert boto, "boto is not installed, cannot access AWS"
assert LooseVersion(boto.Version) >= BOTO_REQUIREMENT, "boto version is too old, cannot access AWS"
assert boto_is_current, "boto version is too old, cannot access AWS"
cloudbase.Provider.__init__(self, AWS_EC2, cloud_prop)
self.log = logging.getLogger(AWS_EC2)
self.region = cloud_prop["region"]
Expand Down
5 changes: 4 additions & 1 deletion tests/test_cloud_aws_comparison.py
@@ -1,7 +1,10 @@
from poni import cloud
from nose import SkipTest
from poni import cloud, cloud_aws

def test_hash():
"""validate aws provider hash and comparison implementation"""
if not cloud_aws.boto_is_current:
raise SkipTest("boto is not installed or is too old")
sky = cloud.Sky()
east_prop = dict(provider="aws-ec2", region="us-east-1")
east1 = sky.get_provider(east_prop)
Expand Down
10 changes: 8 additions & 2 deletions tests/test_vc.py
@@ -1,8 +1,15 @@
from poni import tool
from nose import SkipTest
from poni import tool, vc
from helper import *
import subprocess


class TestVersionControl(Helper):
@classmethod
def setupClass(cls):
if not vc.git:
raise SkipTest("GitPython not installed or too old")

def git(self, repo, cmd):
full_cmd = ["git",
"--git-dir=%s/.git" % repo,
Expand Down Expand Up @@ -39,4 +46,3 @@ def test_checkpoint(self):
assert not poni.run(["vc", "checkpoint", "checkpoint changes"])
assert self.git(repo, ["status", "-s"]) == ""
assert "checkpoint changes" in self.git(repo, ["log"])

0 comments on commit 33dc22c

Please sign in to comment.