PyBaMM icon indicating copy to clipboard operation
PyBaMM copied to clipboard

Tracking Issue for Pytest migration.

Open prady0t opened this issue 1 year ago • 8 comments

This is a tracking issue to keep track of all the files that have been successfully migrated to pytest.

Integration Tests

  • [x] ├── test_experiments.py(#4285) ├── test_models
  • [x] │  ├── standard_model_tests.py(Not needed)
  • [x] │  ├── standard_output_comparison.py(Not needed)
  • [x] │  ├── standard_output_tests.py(Not needed) │  ├── test_full_battery_models │   │  ├── test_equivalent_circuit
  • [x] │   │   │   └── test_thevenin.py(#4238) │   │  ├── test_lead_acid
  • [x] │   │   │   ├── test_asymptotics_convergence.py(#4238)
  • [x] │   │   │   ├── test_compare_basic_models.py(#4238)
  • [x] │   │   │   ├── test_compare_outputs.py(#4238)
  • [x] │   │   │   ├── test_full.py(#4238)
  • [x] │   │   │   ├── test_loqs.py(#4238)
  • [x] │   │   │   ├── test_loqs_surface_form.py(#4238) │   │   │  └── test_side_reactions
  • [x] │   │   │   ├── test_full_side_reactions.py(#4238)
  • [x] │   │   │   └── test_loqs_side_reactions.py(#4238) │   │  └── test_lithium_ion
  • [x] │   │   ├── base_lithium_ion_half_cell_tests.py(Not needed)
  • [x] │   │   ├── ~~base_lithium_ion_tests.py~~(Not needed)
  • [x] │   │   ├── test_basic_models.py(#4238)
  • [x] │   │   ├── test_compare_basic_models.py(#4238)
  • [x] │   │   ├── ~~test_compare_outputs.py~~(Not needed)
  • [x] │   │   ├── test_compare_outputs_two_phase.py(#4285)
  • [x] │   │   ├── test_dfn.py(#4285)
  • [x] │   │   ├── test_dfn_half_cell.py(#4238)
  • [x] │   │   │   └── test_external_temperature.py(#4238)
  • [x] │   │   ├── test_initial_soc.py(#4238)
  • [x] │   │   ├── test_mpm.py(#4285)
  • [x] │   │   ├── test_newman_tobias.py(#4238)
  • [x] │   │   ├── test_spm.py(#4238)
  • [x] │   │   ├── test_spm_half_cell.py(#4238)
  • [x] │   │   ├── test_spme.py(#4238)
  • [x] │   │   ├── test_spme_half_cell.py(#4238)
  • [x] │   │   ├── test_thermal_models.py(#4285)
  • [x] │   │   └── test_yang2017.py(#4238) │ └── test_submodels │   ├── test_external_circuit
  • [x] │   │   └── test_function_control.py(#4285)
  •   │       └──  `test_interface`
    
  • [x] │   ├── test_butler_volmer.py(#4285)
  • [x] │   ├── test_lead_acid.py(#4285)
  • [x] │   └── test_lithium_ion.py(#4285) ├── test_solvers
  • [x] │   ├── test_idaklu.py(#4285)
  • [x] │  └── test_solution.py(#4285) └── test_spatial_methods
  • [x] ├── test_finite_volume.py(#4285)
  • [x] └── test_spectral_volume.py(#4285)

Unit Tests

  • [x] ├── test_batch_study.py (#4333)
  • [x] ├── test_callbacks.py (#4333)
  • [x] ├── test_citations.py (#4333) ├── test_discretisations
  • [x] │   └── test_discretisation.py (#4333)
  • [x] ├── test_doc_utils.py(#4264) ├── test_experiments
  • [x] │   ├── test_experiment.py (#4333)
  • [x] │   ├── test_experiment_step_termination.py
  • [x] │   ├── test_experiment_steps.py (#4333)
  • [x] │   └── test_simulation_with_experiment.py (#4443) ├── test_expression_tree
  • [x] │   ├── test_array.py(#4264)
  • [x] │   ├── test_averages.py (#4333)
  • [x] │   ├── test_binary_operators.py (#4443)
  • [x] │   ├── test_broadcasts.py (#4333)
  • [x] │   ├── test_concatenations.py (#4333)
  • [x] │   ├── test_d_dt.py(#4264)
  • [x] │   ├── test_functions.py (#4333)
  • [x] │   ├── test_independent_variable.py(#4264)
  • [x] │   ├── test_input_parameter.py(#4264)
  • [x] │   ├── test_interpolant.py (#4333)
  • [x] │   ├── test_matrix.py(#4264) │   ├── test_operations
  • [x] │   │   ├── test_convert_to_casadi.py (#4333)
  • [x] │   │   ├── test_copy.py (#4333)
  • [x] │   │   ├── test_evaluate_python.py (#4333)
  • [x] │   │   ├── test_jac.py (#4333)
  • [x] │   │   ├── test_jac_2D.py
  • [x] │   │   ├── test_latexify.py (#4333)
  • [x] │   │   └── test_unpack_symbols.py(#4264)
  • [x] │   ├── test_parameter.py (#4333) │   ├── test_printing
  • [x] │   │   ├── test_print_name.py(#4264)
  • [x] │   │   └── test_sympy_overrides.py(#4264)
  • [x] │   ├── test_scalar.py(#4264)
  • [x] │   ├── test_state_vector.py (#4333)
  • [x] │   ├── test_symbol.py (#4333)
  • [x] │   ├── test_symbolic_diff.py (#4354)
  • [x] │   ├── test_unary_operators.py (#4354)
  • [x] │   ├── test_variable.py
  • [x] │   └── test_vector.py(#4264) ├── test_geometry
  • [x] │   └── test_battery_geometry.py (#4354)
  • [x] ├── test_logger.py(#4264) ├── test_meshes
  • [x] │   ├── test_meshes.py (#4354)
  • [x] │   ├── test_one_dimensional_submesh.py (#4354)
  • [x] │   ├── test_scikit_fem_submesh.py (#4354)
  • [x] │   └── test_zero_dimensional_submesh.py(#4264) ├── test_models
  • [x] │   ├── test_base_model.py (#4354)
  • [x] │   ├── test_event.py(#4264) │   ├── test_full_battery_models
  • [x] │   │   ├── test_base_battery_model.py (#4443 ) │   │   ├── test_equivalent_circuit
  • [x] │   │   │   └── test_thevenin.py (#4354) │   │   ├── test_lead_acid
  • [x] │   │   │   ├── test_base_lead_acid_model.py(#4264)
  • [x] │   │   │   ├── test_basic_models.py(#4264)
  • [x] │   │   │   ├── test_full.py(#4264)
  • [x] │   │   │   └── test_loqs.py (#4354) │   │   └── test_lithium_ion
  • [x] │   │   ├── base_lithium_ion_half_cell_tests.py
  • [x] │   │   ├── base_lithium_ion_tests.py
  • [x] │   │   ├── test_Yang2017.py(#4264)
  • [x] │   │   ├── test_base_lithium_ion_model.py(#4264)
  • [x] │   │   ├── test_basic_models.py(#4264)
  • [x] │   │   ├── test_dfn.py(#4264)
  • [x] │   │   ├── test_dfn_half_cell.py(#4264)
  • [x] │   │   ├── test_electrode_soh.py (#4354)
  • [x] │   │   ├── test_mpm.py (#4354)
  • [x] │   │   ├── test_mpm_half_cell.py(#4264)
  • [x] │   │   ├── test_msmr.py(#4264)
  • [x] │   │   ├── test_newman_tobias.py(#4264)
  • [x] │   │   ├── test_spm.py(#4264)
  • [x] │   │   ├── test_spm_half_cell.py(#4264)
  • [x] │   │   ├── test_spme.py(#4264)
  • [x] │   │   └── test_spme_half_cell.py(#4264)
  • [X] │   ├── test_model_info.py(#4264) │   └── test_submodels
  • [x] │   ├── test_base_submodel.py(#4264)
  • [x] │   ├── test_effective_current_collector.py(#4264)
  • [x] │   └── test_particle_polynomial_profile.py(#4264) ├── test_parameters
  • [x] │   ├── test_base_parameters.py(#4264)
  • [x] │   ├── test_bpx.py (#4354)
  • [x] │   ├── test_current_functions.py (#4354)
  • [x] │   ├── test_ecm_parameters.py (#4354)
  • [x] │   ├── test_electrical_parameters.py(#4264)
  • [x] │   ├── test_geometric_parameters.py(#4264)
  • [x] │   ├── test_lead_acid_parameters.py (#4354)
  • [x] │   ├── test_lithium_ion_parameters.py (#4354) │   ├── test_parameter_sets
  • [x] │   │   ├── test_Ai2020.py(#4264)
  • [x] │   │   ├── test_Ecker2015.py(#4264)
  • [x] │   │   ├── test_Ecker2015_graphite_halfcell.py
  • [x] │   │   ├── test_LCO_Ramadass2004.py(#4264)
  • [x] │   │   ├── test_LGM50_ORegan2022.py(#4264)
  • [x] │   │   ├── test_OKane2022.py (#4443)
  • [x] │   │   ├── test_OKane2022_negative_halfcell.py(#4264)
  • [x] │   │   └── test_parameters_with_default_models.py (#4443)
  • [x] │   ├── test_parameter_sets_class.py(#4264)
  • [x] │   ├── test_parameter_values.py (#4431)
  • [x] │   ├── test_process_parameter_data.py (#4431)
  • [x] │   └── test_size_distribution_parameters.py(#4264) ├── test_plotting
  • [x] │   ├── test_plot.py(#4264)
  • [x] │   ├── test_plot_summary_variables.py(#4264)
  • [x] │   ├── test_plot_thermal_components.py(#4264)
  • [x] │   ├── test_plot_voltage_components.py(#4264)
  • [x] │   └── test_quick_plot.py (#4431)
  • [x] ├── test_pybamm_data.py ├── test_serialisation
  • [x] │   └── test_serialisation.py(#4431)
  • [x] ├── test_settings.py(#4264)
  • [x] ├── test_simulation.py(#4431) ├── test_solvers
  • [x] │   ├── test_algebraic_solver.py(#4431)
  • [x] │   ├── test_base_solver.py(#4431)
  • [x] │   ├── test_casadi_algebraic_solver.py(#4431)
  • [x] │   ├── test_casadi_solver.py(#4431)
  • [x] │   ├── test_dummy_solver.py(#4264)
  • [ ] │   ├── test_idaklu_jax.py
  • [x] │   ├── test_idaklu_solver.py(#4431)
  • [x] │   ├── test_jax_bdf_solver.py(#4431)
  • [x] │   ├── test_jax_solver.py(#4431)
  • [x] │   ├── test_lrudict.py(#4264)
  • [x] │   ├── test_processed_variable.py(#4431)
  • [x] │   ├── test_processed_variable_computed.py(#4431)
  • [x] │   ├── test_scipy_solver.py (#4443)
  • [ ] │   └── test_solution.py ├── test_spatial_methods
  • [x] │   ├── test_base_spatial_method.py(#4431) │   ├── test_finite_volume
  • [x] │   │   ├── test_extrapolation.py(#4431)
  • [x] │   │   ├── test_finite_volume.py(#4431)
  • [x] │   │   ├── test_ghost_nodes_and_neumann.py(#4431)
  • [x] │   │   ├── test_grad_div_shapes.py(#4431)
  • [x] │   │   └── test_integration.py(#4431)
  • [x] │   ├── test_scikit_finite_element.py(#4431)
  • [x] │   ├── test_spectral_volume.py(#4431)
  • [x] │   └── test_zero_dimensional_method.py(#4264)
  • [x] ├── test_timer.py(#4264)
  • [x] └── test_util.py (#4214)

Note :

  • [x] Use setup_method instead of fixtures everywhere.
  • [ ] test_citations.py : This is an example of a file that contains a lot of boilerplate and can be reduced by fixtures and parametrizing the test cases
  • [ ] Parameterize tests/unit/test_parameters/test_process_parameter_data.py

prady0t avatar Jun 09 '24 10:06 prady0t

@prady0t Can you summarize what is not covered in #3617 so that we can close the older issue?

kratman avatar Jun 09 '24 16:06 kratman

I closed the older issue, just the updates to the Contributing Guide and the removal of the run-tests.py file remain, which are being tracked through weekly updates.

agriyakhetarpal avatar Jun 09 '24 20:06 agriyakhetarpal

there are still 14 files left. I should open a new PR concluding everything or should I cover them in pt-7?

prady0t avatar Sep 13 '24 12:09 prady0t

A new PR would be better. Part 6 and Part 7 are ready to merge, I approved them

agriyakhetarpal avatar Sep 13 '24 12:09 agriyakhetarpal

Correction : 9 files

prady0t avatar Sep 13 '24 12:09 prady0t

Almost there with completing them all!

agriyakhetarpal avatar Sep 13 '24 12:09 agriyakhetarpal

@prady0t, after #4443, it looks like 8 files are still left:

❯ rg unittest
tests/testcase.py
4:import unittest
7:class TestCase(unittest.TestCase):

tests/integration/test_models/test_submodels/test_interface/test_butler_volmer.py
8:import unittest
12:class TestButlerVolmer(unittest.TestCase):
387:    unittest.main()

tests/unit/test_expression_tree/test_concatenations.py
5:import unittest.mock as mock

tests/unit/test_parameters/test_parameter_sets/test_Ecker2015.py
6:import unittest
9:class TestEcker2015(unittest.TestCase):
55:    unittest.main()

tests/unit/test_expression_tree/test_functions.py
6:import unittest.mock as mock

tests/unit/test_expression_tree/test_input_parameter.py
7:import unittest.mock as mock

tests/unit/test_expression_tree/test_operations/test_evaluate_python.py
9:import unittest
758:    unittest.main()

tests/integration/test_models/test_full_battery_models/test_lithium_ion/test_compare_outputs.py
7:import unittest
11:class TestCompareOutputs(unittest.TestCase):
153:    unittest.main()

Could you migrate these files, too? Also, please check for any additional files that were missed.

agriyakhetarpal avatar Sep 28 '24 16:09 agriyakhetarpal

Thanks for pointing out! Check #4472

prady0t avatar Sep 28 '24 17:09 prady0t

@prady0t Is this done now?

kratman avatar Nov 13 '24 15:11 kratman

Yes, I think this can be closed.

prady0t avatar Nov 15 '24 14:11 prady0t