language: python

sudo: false

env:
  - TEST_TARGET=default
  - TEST_TARGET=notebooks

before_install:
  - wget http://bit.ly/miniconda -O miniconda.sh
  - bash miniconda.sh -b -p $HOME/miniconda
  - export PATH="$HOME/miniconda/bin:$PATH"
  - conda update --yes --all
  - conda config --add channels conda-forge --force

install:
  - conda env create environment.yml
  - source activate IOOS
  - conda install flake8 pytest --yes

script:
  - if [[ $TEST_TARGET == 'default' ]]; then
      find . -type f -name "*.py" ! -name 'conf.py' | xargs flake8 --max-line-length=100 ;
      for file in $(find . -type f -name "*.ipynb"); do jupyter nbconvert --template=tests/strip_markdown.tpl --stdout --to python $file | grep -v '^get_ipython' | flake8 - --ignore=W391,E226,E402 --max-line-length=100 --show-source ; done ;
    fi
  - if [[ $TEST_TARGET == 'notebooks' ]]; then
      cd tests && python test_notebooks.py ;
    fi

language: python

sudo: false

env:
  - TEST_TARGET=default
  - TEST_TARGET=notebooks

before_install:
  - wget http://bit.ly/miniconda -O miniconda.sh
  - bash miniconda.sh -b -p $HOME/miniconda
  - export PATH="$HOME/miniconda/bin:$PATH"
  - conda update --yes --all
  - conda config --add channels conda-forge --force

install:
  - conda env create environment.yml
  - source activate IOOS
  - conda install flake8 pytest --yes

# The notebook PEP 8 test ignore:
# W391: blank line at end of file (always present when using nbconvert)
# E226: missing whitespace around arithmetic operator (not enforced by PEP 8)
# E402: module level import not at top of file (in notebooks it is clearer to import in the first cell the module is used.)
# In addition the magic cells are skipped with `grep -v '^get_ipython'` b/c they are not compliant when converted to script.

script:
  - if [[ $TEST_TARGET == 'default' ]]; then
      find . -type f -name "*.py" ! -name 'conf.py' | xargs flake8 --max-line-length=100 ;
      for file in $(find . -type f -name "*.ipynb"); do jupyter nbconvert --template=tests/strip_markdown.tpl --stdout --to python $file | grep -v '^get_ipython' | flake8 - --ignore=W391,E226,E402 --max-line-length=100 --show-source ; done ;
    fi
  - if [[ $TEST_TARGET == 'notebooks' ]]; then
      cd tests && python test_notebooks.py ;
    fi

Add some comments to explain the tests
Add some comments to explain the tests
