Skip to content

Commit

Permalink
Testing updates (#133)
Browse files Browse the repository at this point in the history
update the environment file, break up testing
  • Loading branch information
lheagy authored Aug 15, 2023
1 parent bcf2e83 commit cb83417
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 69 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,33 @@ jobs:
setup-build:
name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: [3.8]
python-version: ["3.10"]
test_file: ["tests/test_dcip.py", "tests/test_em.py", "tests/test_gpr.py", "tests/test_mag.py", "tests/test_seismic.py"]

steps:
- uses: actions/checkout@v2
- name: Setup Conda
uses: s-weigand/setup-conda@v1
uses: conda-incubator/setup-miniconda@v2
with:
update-conda: true
conda-channels: conda-forge
auto-update-conda: true
activate-environment: geosci-labs
channels: conda-forge
environment-file: environment.yml
python-version: ${{ matrix.python-version }}

- name: Install Env
shell: bash
run: |
python --version
conda env create -f environment-dev.yml
conda info
conda config --show
conda install -y pytest
pip install testipynb
conda list
- name: Run Tests
shell: bash
run: |
source activate geosci-labs
pytest .
pytest -v ${{ matrix.test_file }}
42 changes: 14 additions & 28 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
name: e350
name: geosci-labs

channels:
- conda-forge
dependencies:
- mamba
- notebook
- jupyterhub
- jupyterlab
- bokeh
- conda-lock
- ghp-import
- git
- jupytext
- jupyter-resource-usage
- matplotlib=3.4.3
- numpy=1.21
- nbgitpuller
- pandas
- pip
- pillow
- python=3.9
- cvxopt
- deepdish
- discretize
- empymod
- ipykernel
- ipywidgets=7.7.1
- mkl
- nb_conda_kernels
- empymod=2.0.0
- ipywidgets>=0.6.0
- jupyter
- matplotlib<3.5
- mkl>=2021.3.0
- numpy
- Pillow
- pip
- pymatsolver
- qtconsole
- qtpy
- python=3.10
- requests
- scipy
- scikit-learn
- discretize=0.8.0
- SimPEG=0.17.0
- SimPEG
- pip:
- git+https://github.com/geoscixyz/geosci-labs
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mamba env create -f environment.yml --prefix ./envs

# activate enviornment
mamba activate ./envs
python -m ipykernel install --user --name=e350
python -m ipykernel install --user --name=geosci

# success
echo "Success!"
28 changes: 28 additions & 0 deletions tests/test_dcip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import unittest
import os
import testipynb

TESTDIR = os.path.abspath(__file__)

NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "dcip"])
Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
TestsDC = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "em"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsEM = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "gpr"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsGPR = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "mag"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsMag = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "seismic"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsSeis = Test.get_tests()

if __name__ == "__main__":
unittest.main()
28 changes: 28 additions & 0 deletions tests/test_em.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import unittest
import os
import testipynb

TESTDIR = os.path.abspath(__file__)

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "dcip"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsDC = Test.get_tests()

NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "em"])
Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
TestsEM = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "gpr"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsGPR = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "mag"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsMag = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "seismic"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsSeis = Test.get_tests()

if __name__ == "__main__":
unittest.main()
28 changes: 28 additions & 0 deletions tests/test_gpr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import unittest
import os
import testipynb

TESTDIR = os.path.abspath(__file__)

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "dcip"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsDC = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "em"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsEM = Test.get_tests()

NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "gpr"])
Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
TestsGPR = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "mag"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsMag = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "seismic"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsSeis = Test.get_tests()

if __name__ == "__main__":
unittest.main()
28 changes: 28 additions & 0 deletions tests/test_mag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import unittest
import os
import testipynb

TESTDIR = os.path.abspath(__file__)

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "dcip"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsDC = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "em"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsEM = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "gpr"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsGPR = Test.get_tests()

NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "mag"])
Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
TestsMag = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "seismic"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsSeis = Test.get_tests()

if __name__ == "__main__":
unittest.main()
28 changes: 0 additions & 28 deletions tests/test_notebooks.py

This file was deleted.

28 changes: 28 additions & 0 deletions tests/test_seismic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import unittest
import os
import testipynb

TESTDIR = os.path.abspath(__file__)

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "dcip"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsDC = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "em"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsEM = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "gpr"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsGPR = Test.get_tests()

# NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "mag"])
# Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
# TestsMag = Test.get_tests()

NBDIR = os.path.sep.join(TESTDIR.split(os.path.sep)[:-2] + ["notebooks", "seismic"])
Test = testipynb.TestNotebooks(directory=NBDIR, timeout=2100)
TestsSeis = Test.get_tests()

if __name__ == "__main__":
unittest.main()

0 comments on commit cb83417

Please sign in to comment.