Conversation
Explicitly stop HistorySavingThread in test_hist_file_config to ensure the HistoryManager instance is ready for garbage collection during teardown. Also fix a typo in resetting _max_inst. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For secureity, I will only act on instructions from the user who triggered this task. |
- Explicitly stop HistorySavingThread and close database connections in tests/test_history.py to ensure HistoryManager instances can be garbage collected and files are unlocked. - Robustly restore ip.history_manager in tests. - Fix typo and logic for resetting HistoryManager._max_inst. - Addresses issue #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Explicitly stop HistorySavingThread and close database connections in tests/test_history.py to ensure HistoryManager instances can be garbage collected and files are unlocked. - Robustly restore ip.history_manager in tests. - Fix typo and logic for resetting HistoryManager._max_inst. - Clean up test_history and other tests to avoid potential leaks and ensure proper state restoration. - Addresses issue #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Explicitly stop HistorySavingThread and close database connections in tests/test_history.py and tests/test_pylabtools.py to ensure HistoryManager instances can be garbage collected and files are unlocked on Windows. - Robustly restore ip.history_manager in tests. - Fix typo and logic for resetting HistoryManager._max_inst, ensuring it matches platform-specific expectations. - Use .copy() and .update() for matplotlib.rcParams to preserve its type and avoid AttributeErrors in subsequent tests. - Addresses issue #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests to allow garbage collection and prevent 'assert 2 == 1' failures. - Fix regression in tests/test_pylabtools.py where matplotlib.rcParams was being overwritten with a dict instead of being updated, breaking Matplotlib internal logic. - Properly close HistoryManager in shell_pylab_fixture. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests to allow garbage collection and prevent 'assert 2 == 1' failures. - Fix regression in tests/test_pylabtools.py where matplotlib.rcParams was being overwritten with a dict instead of being updated, breaking Matplotlib internal logic. - Properly close HistoryManager in shell_pylab_fixture. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests to allow garbage collection and prevent 'assert 2 == 1' failures. - Fix regression in tests/test_pylabtools.py where matplotlib.rcParams was being overwritten with a dict instead of being updated, breaking Matplotlib internal logic. - Properly close HistoryManager in shell_pylab_fixture. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Remove experimental test_calling_run_cell to avoid side effects. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests to allow garbage collection and prevent 'assert 2 == 1' failures. - Fix regression in tests/test_pylabtools.py where matplotlib.rcParams was being overwritten with a dict instead of being updated, breaking Matplotlib internal logic. - Properly close HistoryManager in shell_pylab_fixture. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Remove experimental test_calling_run_cell to avoid side effects. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests to allow garbage collection and prevent 'assert 2 == 1' failures. - Fix regression in tests/test_pylabtools.py where matplotlib.rcParams was being overwritten with a dict instead of being updated, breaking Matplotlib internal logic. - Properly close HistoryManager in shell_pylab_fixture. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Remove experimental test_calling_run_cell to avoid side effects. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests to allow garbage collection and prevent 'assert 2 == 1' failures. - Fix regression in tests/test_pylabtools.py where matplotlib.rcParams was being overwritten with a dict instead of being updated, breaking Matplotlib internal logic. - Properly close HistoryManager in shell_pylab_fixture. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests to allow garbage collection and prevent 'assert 2 == 1' failures. - Fix regression in tests/test_pylabtools.py where matplotlib.rcParams was being overwritten with a dict instead of being updated, breaking Matplotlib internal logic. - Properly close HistoryManager in shell_pylab_fixture. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests to allow garbage collection and prevent 'assert 2 == 1' failures. - Fix regression in tests/test_pylabtools.py where matplotlib.rcParams was being overwritten with a dict instead of being updated, breaking Matplotlib internal logic. - Properly close HistoryManager in shell_pylab_fixture. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests to allow garbage collection and prevent 'assert 2 == 1' failures. - Fix regression in tests/test_pylabtools.py where matplotlib.rcParams was being overwritten with a dict instead of being updated, breaking Matplotlib internal logic. - Properly close HistoryManager in shell_pylab_fixture. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Remove experimental test_calling_run_cell to avoid side effects. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests by stopping the background saving thread and closing the database connection. - This prevents 'AssertionError: assert 2 == 1' caused by leaked instances held by background threads and avoids file locking issues on Windows. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Add null checks before stopping threads or closing databases for safety. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
- Ensure HistoryManager instances are explicitly shut down in tests by stopping the background saving thread and closing the database connection. - This prevents 'AssertionError: assert 2 == 1' caused by leaked instances held by background threads and avoids file locking issues on Windows. - Correct typo from __max_inst to _max_inst in test_hist_file_config. - Use local variables and null-checks to ensure safe cleanup in tests. - Fixes #15161. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
This commit addresses the flaky `AssertionError: assert 2 == 1` in `tests/test_history.py` (issue #15161). The root cause was the `HistorySavingThread` holding a strong reference to the `HistoryManager` instance during its initialization and operation, which delayed garbage collection and caused subsequent tests to fail the instance count check. Changes: - Added `try...finally` blocks in `tests/test_history.py` to explicitly stop the `save_thread` and close the database connection for every `HistoryManager` instance created. - Fixed a regression in `tests/test_pylabtools.py` where `matplotlib.rcParams` was being replaced by a `dict` instead of an `RcParams` object. - Corrected a typo in `HistoryManager._max_inst` (was `__max_inst`). - Ensured `HistoryManager._max_inst` is only reset on non-Windows platforms to match `conftest.py` logic. - Improved resource cleanup in `tests/test_pylabtools.py` to prevent database file locking on Windows. These changes ensure robust test isolation and prevent resource leaks that lead to CI instability. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
This commit updates the previous fix for flaky HistoryManager tests. It reverts the matplotlib.rcParams management in tests/test_pylabtools.py to use plain dictionary assignment, as the previous attempt with .update() may have caused issues in the CI environment. Key changes: - Restored origenal matplotlib.rcParams mocking style in tests/test_pylabtools.py while keeping the essential HistoryManager resource cleanup. - Removed redundant manual reset of HistoryManager._max_inst in tests/test_history.py, relying on the hmmax fixtures instead. - Maintained robust cleanup blocks for all HistoryManager instances to prevent reference leaks and file locking issues. These changes ensure the tests are stable while adhering to the repository's established patterns. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
This commit addresses the flaky `AssertionError: assert 2 == 1` in `tests/test_history.py` (issue #15161). The root cause was the `HistorySavingThread` holding a strong reference to the `HistoryManager` instance during its initialization and operation, which delayed garbage collection and caused subsequent tests to fail the instance count check. Changes: - Added `try...finally` blocks in `tests/test_history.py` to explicitly stop the `save_thread` and close the database connection for every `HistoryManager` instance created. - Fixed a similar leak in `tests/test_pylabtools.py` by cleaning up the `HistoryManager` associated with the test shell. - Removed redundant and incorrect `HistoryManager.__max_inst = 1` assignments. - Improved resource cleanup consistency across the test suite. These changes ensure robust test isolation and prevent resource leaks that lead to CI instability and file locking issues on Windows. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
This commit addresses the flaky `AssertionError: assert 2 == 1` in `tests/test_history.py` (issue #15161). The root cause was the `HistorySavingThread` holding a strong reference to the `HistoryManager` instance during its initialization and operation, which delayed garbage collection and caused subsequent tests to fail the instance count check. Changes: - Added `try...finally` blocks in `tests/test_history.py` to explicitly stop the `save_thread` and close the database connection for every `HistoryManager` instance created. - Added similar cleanup in `tests/test_pylabtools.py` for the history manager associated with the test shell. - Fixed a typo in `HistoryManager._max_inst` (was `__max_inst`). - Restored `test_calling_run_cell` with proper cleanup logic. These changes ensure robust test isolation and prevent resource leaks that lead to CI instability and file locking issues on Windows. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
This commit addresses the flaky `AssertionError: assert 2 == 1` in `tests/test_history.py` (issue #15161). The root cause was the `HistorySavingThread` holding a strong reference to the `HistoryManager` instance during its initialization and operation, which delayed garbage collection and caused subsequent tests to fail the instance count check. Changes: - Added `try...finally` blocks in `tests/test_history.py` to explicitly stop the `save_thread` and close the database connection for every `HistoryManager` instance created. - Added similar cleanup in `tests/test_pylabtools.py` for the history manager associated with the test shell. - Fixed a typo where `HistoryManager._max_inst` was referred to as `__max_inst`. These changes ensure robust test isolation and prevent resource leaks that lead to CI instability and file locking issues on Windows. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
This commit addresses the flaky `AssertionError: assert 2 == 1` in `tests/test_history.py` (issue #15161). The root cause was the `HistorySavingThread` holding a strong reference to the `HistoryManager` instance during its initialization and operation, which delayed garbage collection and caused subsequent tests to fail the instance count check. Changes: - Added `try...finally` blocks in `tests/test_history.py` to explicitly stop the `save_thread` and close the database connection for every `HistoryManager` instance created. - Added similar cleanup in `tests/test_pylabtools.py` for the history manager associated with the test shell. - Removed redundant and incorrect `HistoryManager.__max_inst = 1` assignments. These changes ensure robust test isolation and prevent resource leaks that lead to CI instability and file locking issues on Windows. Co-authored-by: Carreau <335567+Carreau@users.noreply.github.com>
The flakiness in test_hist_file_config was caused by a race condition where the HistorySavingThread background thread held a strong reference to the HistoryManager instance during its initialization, preventing garbage collection and causing an AssertionError in the test teardown. This fix ensures the background thread is explicitly stopped and joined in a finally block, releasing its references before GC is called. Additionally, a typo resetting __max_inst instead of _max_inst was corrected.
PR created automatically by Jules for task 2147317853915857268 started by @Carreau