Skip to content
Snippets Groups Projects
Commit c4eea2e6 authored by John Chilton's avatar John Chilton
Browse files

Remove .travis.yml installation of condor - it doesn't work on Ubuntu LTS....

Remove .travis.yml installation of condor - it doesn't work on Ubuntu LTS. Make condor and DRMAA based tests skipable if external environment not configured properly.
parent 4cd4ce35
No related branches found
No related tags found
No related merge requests found
## Add to .hg/hgrc to enable bitbucket pushes to push to github as well.
# [hooks]
# outgoing = hg push git+ssh://git@github.com/jmchilton/lwr.git || true
language: python language: python
python: python:
- 2.6 - 2.6
...@@ -22,7 +19,7 @@ install: ...@@ -22,7 +19,7 @@ install:
- sudo python scripts/configure_test_slurm.py - sudo python scripts/configure_test_slurm.py
- echo "export DRMAA_LIBRARY_PATH=/usr/lib/libdrmaa.so" >> local_env.sh - echo "export DRMAA_LIBRARY_PATH=/usr/lib/libdrmaa.so" >> local_env.sh
- pip install drmaa - pip install drmaa
- sudo apt-get install condor # - sudo apt-get install condor
script: . local_env.sh; nosetests script: . local_env.sh; nosetests
matrix: matrix:
include: include:
......
from os.path import join from os.path import join
from .test_utils import TempDirectoryTestCase from .test_utils import TempDirectoryTestCase, skipUnlessExecutable, skipUnlessEnvironVariable
from lwr.util import Bunch from lwr.util import Bunch
from .check import run from .check import run
...@@ -11,6 +11,7 @@ except ImportError: ...@@ -11,6 +11,7 @@ except ImportError:
class IntegrationTest(TempDirectoryTestCase): class IntegrationTest(TempDirectoryTestCase):
@skipUnlessEnvironVariable("DRMAA_LIBRARY_PATH")
def test_integration_as_user(self): def test_integration_as_user(self):
self.__run(job_conf_props={'type': 'queued_external_drmaa', "production": "false"}, private_token=None, default_file_action="copy", user='u1') self.__run(job_conf_props={'type': 'queued_external_drmaa', "production": "false"}, private_token=None, default_file_action="copy", user='u1')
...@@ -35,9 +36,11 @@ class IntegrationTest(TempDirectoryTestCase): ...@@ -35,9 +36,11 @@ class IntegrationTest(TempDirectoryTestCase):
def test_integration_errors(self): def test_integration_errors(self):
self.__run(app_conf={"private_key": "testtoken"}, private_token="testtoken", transport="curl", test_errors=True) self.__run(app_conf={"private_key": "testtoken"}, private_token="testtoken", transport="curl", test_errors=True)
@skipUnlessEnvironVariable("DRMAA_LIBRARY_PATH")
def test_integration_drmaa(self): def test_integration_drmaa(self):
self.__run(app_conf={}, job_conf_props={'type': 'queued_drmaa'}, private_token=None) self.__run(app_conf={}, job_conf_props={'type': 'queued_drmaa'}, private_token=None)
@skipUnlessExecutable("condor_submit")
def test_integration_condor(self): def test_integration_condor(self):
self.__run(app_conf={}, job_conf_props={'type': 'queued_condor'}, private_token=None) self.__run(app_conf={}, job_conf_props={'type': 'queued_condor'}, private_token=None)
......
from contextlib import contextmanager from contextlib import contextmanager
from stat import S_IXOTH from stat import S_IXOTH
from os import pardir, stat, chmod from os import pardir, stat, chmod, access, X_OK, pathsep, environ
from os.path import join, dirname from os.path import join, dirname, isfile, split
from tempfile import mkdtemp from tempfile import mkdtemp
from shutil import rmtree from shutil import rmtree
from sys import version_info from sys import version_info
if version_info < (2, 7): if version_info < (2, 7):
from unittest2 import TestCase from unittest2 import TestCase, skip
else: else:
from unittest import TestCase from unittest import TestCase, skip
from webtest import TestApp from webtest import TestApp
from webtest.http import StopableWSGIServer from webtest.http import StopableWSGIServer
...@@ -131,6 +131,37 @@ def test_app(global_conf={}, app_conf={}, test_conf={}): ...@@ -131,6 +131,37 @@ def test_app(global_conf={}, app_conf={}, test_conf={}):
pass pass
def skipUnlessExecutable(executable):
if __which(executable):
return lambda func: func
return skip("PATH doesn't contain executable {!r}".format(executable))
def skipUnlessEnvironVariable(variable):
if variable in environ:
return lambda func: func
return skip("Environment variable %s is not defined." % variable)
def __which(program):
def is_exe(fpath):
return isfile(fpath) and access(fpath, X_OK)
fpath, fname = split(program)
if fpath:
if is_exe(program):
return program
else:
for path in environ["PATH"].split(pathsep):
path = path.strip('"')
exe_file = join(path, program)
if is_exe(exe_file):
return exe_file
return None
class TestAuthorizer(object): class TestAuthorizer(object):
def __init__(self): def __init__(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment