Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JOSS Review] - tests failing #38

Closed
hjelmj opened this issue May 31, 2024 · 2 comments
Closed

[JOSS Review] - tests failing #38

hjelmj opened this issue May 31, 2024 · 2 comments

Comments

@hjelmj
Copy link

hjelmj commented May 31, 2024

Dear authors,
I ran the tests in the repository using pytest and it looks like there is an issue with a test failing. Perhaps a good idea to add automated testing using Github CI / Github Actions? I have pasted in the output below:

(base) ➜ rfbzero git:(main) pytest tests/
============================= test session starts ==============================
platform darwin -- Python 3.11.8, pytest-7.4.0, pluggy-1.0.0
rootdir: /Users/johh/github/rfbzero
configfile: pyproject.toml
plugins: anyio-4.2.0
collected 73 items

tests/test_crossover.py .. [ 2%]
tests/test_degradation.py ......................... [ 36%]
tests/test_experiment.py .......F.......... [ 61%]
tests/test_redox_flow_cell.py ............................ [100%]

=================================== FAILURES ===================================
___________________________ TestLowCapacity.test_cc ____________________________

self = <tests.test_experiment.TestLowCapacity object at 0x117c58cd0>
capsys = <_pytest.capture.CaptureFixture object at 0x117ccced0>

def test_cc(self, capsys):
    deg = ChemicalDegradationReduced(rate_order=2, rate_constant=10)

    cell = ZeroDModel(volume_cls=0.005,  # L
                      volume_ncls=0.03,  # L
                      c_ox_cls=0.01,  # M
                      c_red_cls=0.01,  # M
                      c_ox_ncls=0.01,  # M
                      c_red_ncls=0.01,  # M
                      ocv_50_soc=0.0,  # V
                      resistance=0.8,  # ohms
                      k_0_cls=1e-3,  # cm/s
                      k_0_ncls=1e-3,  # cm/s
                      )
    protocol = ConstantCurrent(voltage_limit_charge=0.2,  # V
                               voltage_limit_discharge=-0.2,  # V
                               current=0.05,  # A
                               )
    all_results = protocol.run(cell_model=cell,
                               duration=1000,  # cycle time to simulate (s)
                               degradation=deg,
                               )

    warn_out = "capacity is less than 1% of initial CLS capacity."
    captured = capsys.readouterr()

    cyclestatus = captured.out.strip().rsplit('time steps: ', 1)[1]
  assert cyclestatus == warn_out

E AssertionError: assert 'CyclingStatus.LOW_CAPACITY.' == 'capacity is ...CLS capacity.'
E - capacity is less than 1% of initial CLS capacity.
E + CyclingStatus.LOW_CAPACITY.

tests/test_experiment.py:536: AssertionError
=========================== short test summary info ============================
FAILED tests/test_experiment.py::TestLowCapacity::test_cc - AssertionError: assert 'CyclingStatus.LOW_CAPACITY.' == 'capacity is ...CLS...
======================== 1 failed, 72 passed in 27.35s =========================

@jeremyfell
Copy link
Collaborator

Thank you for raising this! This was due to a CPython 3.11+ issue where the behavior of str/Enum mixins was changed.
We have GitHub actions that run the tests on each pull request, but previously only Python 3.10 was used so this went unnoticed.

This is now fixed in #42, and the GitHub actions have been updated to run the tests with multiple Python versions.

Related to openjournals/joss-reviews#6537.

@hjelmj
Copy link
Author

hjelmj commented Jun 11, 2024

Great, thank you, closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants