From 8fb4277ceef74a642eaa2589780c6736f75ee468 Mon Sep 17 00:00:00 2001 From: Amin Sadeghi Date: Tue, 10 Oct 2023 06:56:23 -0400 Subject: [PATCH 1/2] Update tests to reflect recent API changes --- tests/test_backend.py | 6 ++++-- tests/test_io.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_backend.py b/tests/test_backend.py index e2d2eda0..f610603d 100644 --- a/tests/test_backend.py +++ b/tests/test_backend.py @@ -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) diff --git a/tests/test_io.py b/tests/test_io.py index 53134344..bd6359d2 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -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) From a0929d718754f3f3442b565a8f5feee5a7fa882c Mon Sep 17 00:00:00 2001 From: Amin Sadeghi Date: Tue, 10 Oct 2023 06:57:15 -0400 Subject: [PATCH 2/2] Replace manual tests in CI workflows with pytest --- .github/workflows/nightly.yml | 7 +------ .github/workflows/tests.yml | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 90631c09..1994fc4d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -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 . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4896bdd8..01bb8759 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 .