From c9daf6cf354b91d292b30cf0bab5b0e29eb062a9 Mon Sep 17 00:00:00 2001 From: thalassemia Date: Fri, 13 Dec 2024 02:46:41 -0800 Subject: [PATCH] Clarify local debugging with uv and encourage unit tests in PRs --- doc/ci.rst | 17 +++++++++++++---- doc/workflows.rst | 20 ++++++++++++-------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/doc/ci.rst b/doc/ci.rst index c27b66e69..5f3a4c3fd 100644 --- a/doc/ci.rst +++ b/doc/ci.rst @@ -37,10 +37,19 @@ tasks are: Logs from these tests can be viewed on the GitHub website and we strongly recommend that you get all of these tests passing before merging a PR. -Additionally, we would appreciate if you added tests to improve our test coverage -and improve the likelihood that we catch bugs. This could be as simple as a Python -function with the ``test_`` prefix that ensures some bit of code changed in your -PR works as intended with a few test cases. +When you submit a pull request (PR), a bot will comment with a table showing the current code +coverage of the ``pytest`` suite. As of December 2024, coverage is less than 30% +and even that is misleading because many of the tests are "migration" tests +that compare vEcoli to a snapshot of the original whole cell model. These tests will +be removed in the future as vEcoli is further developed. Additionally, these tests do +not tell us whether the code is working as intended, only that it is working the same +way it worked in the original model. Ideally, we would like to increase test coverage +by adding unit tests which actually test edge cases and ensure the code does what it +is supposed to do. + +To that end, we would appreciate if you added tests as part of your pull requests. +This could be as simple as a Python function with the ``test_`` prefix that ensures +the code added or modified in your PR works as intended using a few test cases. ------- Jenkins diff --git a/doc/workflows.rst b/doc/workflows.rst index 42c2df5f7..02f9fb68b 100644 --- a/doc/workflows.rst +++ b/doc/workflows.rst @@ -740,9 +740,8 @@ the output directory specified via ``out_dir`` or ``out_uri`` under the - ``nextflow_workdirs``: Contains all working directories for Nextflow jobs. Required for resume functionality described in :ref:`fault_tolerance`. Can also go to work directory for a job (consult files described in :ref:`progress` - or ``{experiment ID}_report.html``) and run ``bash .command.sh`` with - breakpoints set in the relevant code (``import ipdb; ipdb.set_trace()``) - for debugging. + or ``{experiment ID}_report.html``) for debugging. See :ref:`make_and_test` + for more information. .. tip:: To save space, you can safely delete ``nextflow_workdirs`` after you are finished @@ -795,6 +794,8 @@ in a workflow called ``agitated_mendel``:: nextflow log agitated_mendel -f name,stderr,workdir -F "status == 'FAILED'" +.. _make_and_test: + Make and Test Fixes =================== @@ -810,11 +811,14 @@ Add breakpoints to any Python file with the following line:: import ipdb; ipdb.set_trace() Then, navigate to the working directory (see :ref:`troubleshooting`) for a -failing process. ``bash .command.run`` should re-run the job and pause upon -reaching the breakpoints you set. You should now be in an ipdb shell which -you can use to examine variable values or step through the code. +failing process. Invoke ``uv run --env-file {} .command.run``, replacing +the curly braces with the path to the ``.env`` file in your cloned repository. +This should re-run the job and pause upon reaching the breakpoints you set. +You should now be in an ipdb shell which you can use to examine variable values +or step through the code. After fixing the issue, you can resume the workflow (avoid re-running already successful jobs) by navigating back to the directory in which you -originally started the workflow and issuing the same command with the -``--resume`` option (see :ref:`fault_tolerance`). +originally started the workflow and issuing the same command +(:py:mod:`runscripts.workflow`) with the ``--resume`` option +(see :ref:`fault_tolerance`).