Skip to content

Commit

Permalink
Skip tests that need aws credentials by default
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoRoth committed Apr 23, 2018
1 parent 7bd903a commit 64019a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions oggm/tests/__init__.py
Expand Up @@ -47,6 +47,7 @@
RUN_GRAPHIC_TESTS = True
RUN_BENCHMARK_TESTS = True
RUN_PERFORMANCE_TESTS = False
RUN_CREDENTIAL_TESTS = False
if os.environ.get('TRAVIS') is not None:
# specific to travis to reduce global test time
ON_TRAVIS = True
Expand Down Expand Up @@ -118,6 +119,8 @@
RUN_SLOW_TESTS = True
if os.environ.get('OGGM_DOWNLOAD_TESTS') is not None:
RUN_DOWNLOAD_TESTS = True
if os.environ.get('OGGM_CREDENTIAL_TESTS') is not None:
RUN_CREDENTIAL_TESTS = True

# quick n dirty method to see if internet is on
try:
Expand Down Expand Up @@ -163,3 +166,9 @@ def is_performance_test(test):
# Test decorator
msg = "requires explicit environment for performance tests"
return test if RUN_PERFORMANCE_TESTS else unittest.skip(msg)(test)


def is_download_cred(test):
# Test decorator
msg = "requires explicit environment for download and credential tests (AWS)"
return test if RUN_CREDENTIAL_TESTS and RUN_DOWNLOAD_TESTS else unittest.skip(msg)(test)
6 changes: 3 additions & 3 deletions oggm/tests/test_utils.py
Expand Up @@ -15,7 +15,7 @@
import oggm
from oggm import utils
from oggm import cfg
from oggm.tests import is_download
from oggm.tests import is_download, is_download_cred
from oggm.tests.funcs import get_test_dir, patch_url_retrieve_github, init_hef
from oggm.utils import shape_factor_adhikari
_url_retrieve = None
Expand Down Expand Up @@ -760,7 +760,7 @@ def test_srtmdownloadfails(self):
zone = '41_20'
self.assertTrue(utils._download_srtm_file(zone) is None)

@is_download
@is_download_cred
def test_asterdownload(self):

# this zone does exist and file should be small enough for download
Expand All @@ -780,7 +780,7 @@ def test_iceland(self):
fp, z = utils.get_topo_file([-20, -20], [65, 65])
self.assertTrue(os.path.exists(fp[0]))

@is_download
@is_download_cred
def test_asterdownloadfails(self):

# this zone does not exist
Expand Down

0 comments on commit 64019a2

Please sign in to comment.