Skip to content

Commit

Permalink
Merge pull request #37 from AUTODIAL/tests/pytest
Browse files Browse the repository at this point in the history
Update CI workflows to use `pytest`
  • Loading branch information
ma-sadeghi authored Oct 10, 2023
2 parents 931ee67 + a0929d7 commit 4e26fe3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,4 @@ jobs:
python -m autoeis install
- name: "Run tests"
run: |
# Test package is importable
python -c 'import autoeis as ae; print("From Python!")'
# Test Julia is accessible
python -c 'import autoeis as ae; Main = ae.julia_helpers.init_julia(); Main.println("From Julia!")'
# Test Julia backend is importable
python -c 'import autoeis as ae; ec = ae.julia_helpers.import_backend(); print(ec)'
pytest .
7 changes: 1 addition & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,4 @@ jobs:
python -m autoeis install
- name: "Run tests"
run: |
# Test package is importable
python -c 'import autoeis as ae; print("From Python!")'
# Test Julia is accessible
python -c 'import autoeis as ae; Main = ae.julia_helpers.init_julia(); Main.println("From Julia!")'
# Test Julia backend is importable
python -c 'import autoeis as ae; ec = ae.julia_helpers.import_backend(); print(ec)'
pytest .
6 changes: 4 additions & 2 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ def test_import_julia_modules():
Main = julia_helpers.init_julia()

# Ensure installed modules can be imported
julia_helpers.import_package(Main, "EquivalentCircuits")
ec = julia_helpers.import_package("EquivalentCircuits", Main=Main)
# Test Main is not required
ec = julia_helpers.import_package("EquivalentCircuits")

# Throw error for non-existent module
with pytest.raises(Exception):
julia_helpers.import_package(Main, "NonExistentModule")
julia_helpers.import_package("NonExistentModule", Main)
4 changes: 2 additions & 2 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def test_load_eis_data():
ae.load_eis_data("nonexistentfile.csv")

# Load a valid txt file of EIS data
fpath = ASSETS_DIR / 'testdata.txt'
df = ae.load_eis_data(fpath)
fpath = ASSETS_DIR / 'test_data.txt'
df = ae.io.load_eis_data(fpath)
frequencies = np.array(df["freq/Hz"]).astype(float)
reals = np.array(df["Re(Z)/Ohm"]).astype(float)
imags = -np.array(df["-Im(Z)/Ohm"]).astype(float)

0 comments on commit 4e26fe3

Please sign in to comment.