Always pass feedstock dir Path to migrator tests#3774
Conversation
Enable `CondaForgeYAMLCleanup` migrator for v1 recipes. Since it works on `conda-forge.yml` only, it does not require any changes. So the most of the changes are related to extending the test.
Fix an exception when the tested v1 recipe has no `license_file` key: E TypeError: 'NoneType' object is not subscriptable
Update the `run_test_migration()` function to always expect the top feedstock directory, passed as `Path`, for both schema versions. Previously, the function would expect feedstock directory for v1 recipes, and the recipe subdirectory for v0 recipes. This improves consistency, as well as modernizes the code. While at it, rewrite the relevant tests to use the modern `tmp_path` fixture rather than the deprecated `tmpdir` fixture.
8128716 to
61f9878
Compare
|
I've rebased it on #3765 to avoid conflicts when it's merged. It's mostly done, still need to update the API for minimigrator and YAML migrator tests. |
Codecov ReportAttention: Patch coverage is
❌ Your project status has failed because the head coverage (93.98%) is below the target coverage (95.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #3774 +/- ##
==========================================
- Coverage 77.30% 75.80% -1.50%
==========================================
Files 134 134
Lines 14855 14849 -6
==========================================
- Hits 11484 11257 -227
- Misses 3371 3592 +221 ☔ View full report in Codecov by Sentry. |
|
Okay, so the changes here include:
When updating code for
I can change that if you prefer. I can also address the remaining uses of |
|
I think I got the conflicts here. sorry for the squash! |
No problem, I treat the followup commits as dispensable. |
beckermr
left a comment
There was a problem hiding this comment.
I have two questions.
- When do we need to call
str()onPathobjects? It is not always done in some spots versus others (e.g., when passing a path to the migrator methods) and I do not understand why. - The use of
/in strings for joining paths like thispathobj / "foo/bar"appears like it would break using the test suite on windows. Is that true? If so, do we care?
I've tried to put it to cf-scripts' functions where
That's the beauty of it — >>> from pathlib import PureWindowsPath
>>> str(PureWindowsPath(r"c:\some\directory") / "foo/bar")
'c:\\some\\directory\\foo\\bar' |
(work-in-progress posted to facilitate early feedback)
Description:
Update the
run_test_migration()function to always expect the top feedstock directory, passed asPath, for both schema versions. Previously, the function would expect feedstock directory for v1 recipes, and the recipe subdirectory for v0 recipes. This improves consistency, as well as modernizes the code.While at it, rewrite the relevant tests to use the modern
tmp_pathfixture rather than the deprecatedtmpdirfixture.Checklist:
Cross-refs, links to issues, etc:
Discussed in #3765.