Skip to content

Commit

Permalink
init tests, add codecov
Browse files Browse the repository at this point in the history
* add test data and initial test

* Create python-package.yml

* if it works and its not pretty

...it still works

* add xr to test dependencies

* use micromamba for deps

* this is going to get pretty "move fast break stuff"

* ...sigh

* here we go again

* I'm close..

* actually activate env

* add nc engine

* add test coverage

* add coverage to actions

* codecov config

* idk anymore

* eh?

* double take?

* disp test result

* ??

* pls
  • Loading branch information
wx4stg authored Dec 24, 2023
1 parent 5619678 commit 7895870
Show file tree
Hide file tree
Showing 45 changed files with 58 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)
eval "$(micromamba shell hook --shell bash)"
micromamba activate base
micromamba install pytest-cov xarray netcdf4 -c conda-forge
python -m pip install .
- name: Test with pytest
run: |
eval "$(micromamba shell hook --shell bash)"
micromamba activate base
coverage run --source=pyxlma -m pytest tests/
coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Binary file added examples/data/lma/WTLMA_231224_005701_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005702_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005704_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005705_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005706_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005707_0001.dat.gz
Binary file not shown.
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005712_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005713_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005714_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005715_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005718_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005719_0001.dat.gz
Binary file not shown.
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005722_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005723_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005724_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005725_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005726_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005728_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005729_0001.dat.gz
Binary file not shown.
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005731_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005733_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005734_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005736_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005737_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005738_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005739_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005740_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005741_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005743_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005744_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005745_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005746_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005750_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005751_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005753_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005754_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005755_0001.dat.gz
Binary file not shown.
Binary file not shown.
Binary file added examples/data/lma/WTLMA_231224_005759_0001.dat.gz
Binary file not shown.
Binary file added examples/data/lma_netcdf/lma.nc
Binary file not shown.
15 changes: 15 additions & 0 deletions tests/test_io.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Test functionality of pyxlma.io"""

from os import listdir
from datetime import datetime as dt
import xarray as xr
from pyxlma.lmalib.io import read as lma_read


def test_read_mf_dataset():
"""Test reading of multiple .dat.gz files into a single lma dataset"""
files_to_read = listdir('examples/data/lma/')
files_to_read = ['examples/data/lma/'+file for file in files_to_read]
dataset, start_date = lma_read.dataset(files_to_read)
assert start_date == dt(2023, 12, 24, 0, 57, 1)
assert dataset == xr.open_dataset('examples/data/lma_netcdf/lma.nc')

0 comments on commit 7895870

Please sign in to comment.