diff --git a/.travis.yml b/.travis.yml index a555855a..6aef1f7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,35 @@ language: python python: - - "2.7" -virtualenv: - system_site_packages: true + - 2.7 + +# Setup anaconda before_install: - - sudo apt-get install -qq gcc gfortran libblas-dev liblapack-dev python-numpy python-scipy python-matplotlib python-pip - - sudo pip install scipy --upgrade - - sudo pip install numpy --upgrade - - cd ../ + - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then wget http://repo.continuum.io/miniconda/Miniconda-3.3.0-Linux-x86_64.sh -O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-3.3.0-Linux-x86_64.sh -O miniconda.sh; fi + - chmod +x miniconda.sh + - ./miniconda.sh -b + - export PATH=/home/travis/anaconda/bin:/home/travis/miniconda/bin:$PATH + - conda update --yes conda + # The next couple lines fix a crash with multiprocessing on Travis and are not specific to using Miniconda + - sudo rm -rf /dev/shm + - sudo ln -s /run/shm /dev/shm + +# Install packages +install: + - conda install --yes pip python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib cython + - pip install nose-cov python-coveralls + # Remove this when SimPEG is on pip - git clone https://github.com/simpeg/simpeg.git - - cd simpeg/SimPEG/ - - python setup.py - - cd ../../ - - echo export PYTHONPATH=$PYTHONPATH:/home/travis/build/simpeg/simpeg >> .bashrc - - source .bashrc - - cd simpegpf -# command to install dependencies -install: "pip install -r requirements.txt --use-mirrors" -# command to run tests -script: nosetests -v + - cd simpeg/ + - python setup.py install + - cd ../ + +# Run test +script: + - nosetests --with-cov --cov simpegEM --cov-config .coveragerc + +# Calculate coverage +after_success: + - coveralls --config_file .coveragerc notifications: email: diff --git a/simpegPF/Tests/test_forward_PFproblem.py b/simpegPF/Tests/test_forward_PFproblem.py index 18419fda..b4af0f4d 100644 --- a/simpegPF/Tests/test_forward_PFproblem.py +++ b/simpegPF/Tests/test_forward_PFproblem.py @@ -8,11 +8,11 @@ class MagFwdProblemTests(unittest.TestCase): def setUp(self): - hxind = ((5,25,1.3),(41, 12.5),(5,25,1.3)) - hyind = ((5,25,1.3),(41, 12.5),(5,25,1.3)) - hzind = ((5,25,1.3),(40, 12.5),(5,25,1.3)) - hx, hy, hz = Utils.meshTensors(hxind, hyind, hzind) - M = Mesh.TensorMesh([hx, hy, hz], [-hx.sum()/2,-hy.sum()/2,-hz.sum()/2]) + cs = 25. + hxind = [(cs,5,-1.3), (cs/2.0, 41),(cs,5,1.3)] + hyind = [(cs,5,-1.3), (cs/2.0, 41),(cs,5,1.3)] + hzind = [(cs,5,-1.3), (cs/2.0, 40),(cs,5,1.3)] + M = Mesh.TensorMesh([hxind, hyind, hzind], 'CCC') chibkg = 0. chiblk = 0.01 diff --git a/simpegPF/Tests/test_sensitivity_PFproblem.py b/simpegPF/Tests/test_sensitivity_PFproblem.py index 63676579..cd2ef5c5 100644 --- a/simpegPF/Tests/test_sensitivity_PFproblem.py +++ b/simpegPF/Tests/test_sensitivity_PFproblem.py @@ -9,12 +9,11 @@ from scipy.constants import mu_0 class MagSensProblemTests(unittest.TestCase): def setUp(self): - - hxind = ((5,25,1.3),(21, 25.),(5,25,1.3)) - hyind = ((5,25,1.3),(21, 25.),(5,25,1.3)) - hzind = ((5,25,1.3),(20, 25.),(5,25,1.3)) - hx, hy, hz = Utils.meshTensors(hxind, hyind, hzind) - M = Mesh.TensorMesh([hx, hy, hz], [-hx.sum()/2,-hy.sum()/2,-hz.sum()/2]) + cs = 25. + hxind = [(cs,5,-1.3), (cs, 21),(cs,5,1.3)] + hyind = [(cs,5,-1.3), (cs, 21),(cs,5,1.3)] + hzind = [(cs,5,-1.3), (cs, 20),(cs,5,1.3)] + M = Mesh.TensorMesh([hxind, hyind, hzind], 'CCC') chibkg = 0.001 chiblk = 0.01 chi = np.ones(M.nC)*chibkg