Conversation
Both shared fixtures passed a bare filename, which resolves against whatever directory pytest was started from, so a unit run left three zero-byte logs in the repository root with nothing ignoring them. They take tmp_path now, and so does the background-plot test, which wrote a fourth there and removed it in a finally that does not run if the process is killed. The new test asserts it on filename rather than on the three file attributes. import_results repoints those at whatever it read, so they say nothing about where a run would write. Putting either bare name back turns it red. monte_carlo_calisto_pre_loaded also read its example by a path relative to the working directory, and import_outputs opens that path "r+", or "w+" when it is missing. The read target is a tracked file opened for writing, and a wrong guess would create one inside the tree. Resolved against the fixture module now. Nothing was being created today, since the file it names does exist. tests/unit/simulation: 333 passed, 7 skipped, and the one failure is the imageio import that is red on develop too. The tree is clean afterwards, which is what this is for. ruff and ruff format are clean. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1197 +/- ##
========================================
Coverage 91.58% 91.58%
========================================
Files 132 132
Lines 18404 18404
========================================
Hits 16855 16855
Misses 1549 1549 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running the unit tests leaves three zero-byte logs in the repository root, and nothing ignores them. Addresses #1189.
Pull request type
Checklist
ruff check/ruff format --check) has passed locallyCHANGELOG.md: nothing user-facing changes here, so no entry.Current behavior
The two shared Monte Carlo fixtures pass a bare
filename="monte_carlo_test", which resolves against whatever directory pytest was started from:test_ellipses_background_saves_file_successfullywrites a fourth into the same place and removes it in afinally, which does not run if the process is killed.New behavior
All three take
tmp_path, so the logs go where pytest already cleans up after itself, and the plot test needs no cleanup clause.A test asserts it, on
filenamerather than on the three file attributes:import_resultsrepoints those at whatever it read, so they are not what the fixtures control. Putting the bare name back turns it red for both fixtures.Breaking change
Test-only.
Additional information
One thing I found while writing the assertion, and fixed with it.
monte_carlo_calisto_pre_loadedalso reads its example file by a path relative to the working directory.import_outputsopens that path"r+", and"w+"when it is missing, so the read target is a tracked file opened for writing and a wrong guess would create one inside the tree. It is resolved against the fixture module now. Nothing was being created today, since the file it names does exist; this is the same defect as the one above rather than a new symptom.What this does not cover, so it is not mistaken for covered.
tests/integration/simulation/test_monte_carlo.pywrites four more files into the working directory, a.kmland three.png, and asserts on them by bare name. Those differ from the case above in that the tests do remove them, through_post_test_file_cleanupin afinally. The gap there is narrower: afinallydoes not run if the process is killed. Changing them means changing the assertions that name them, in a file this branch does not touch and whose tests are marked slow, so I have left them and am saying so rather than letting the issue look fully answered. The three log names in that cleanup list are inert after this change, and I have left those entries alone for the same reason.While there:
import_results(filename=...)hands the same name toimport_outputs,import_inputsandimport_errors, so after the pre-loaded fixture runs, all three attributes point atexample.outputs.txt. I have left that alone, since it is the documented signature rather than anything this changes.Verified on
a50d07d5:The one failure is
test_ellipses_reports_an_image_path_that_does_not_exist, animageioimport this machine cannot satisfy. It is red ondeveloptoo.