-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use consistent filepath pattern matching across the board #39
Conversation
Sorry I'm not familiar enough with Git/Github processes. Anyway... |
Since I now merged #38, you can simply update this branch (pull from original/main) and the commits should disappear from the displayed diff here |
Nice ! I'll modify the github workflow to
I'll do this in another PR, but once it is done we should be able to see it fail correctly :) |
Done. Can you please update this branch, so that we can see if now the windows workers fail too ? |
Success! All tests are now failing! 🤪 |
Cool ! Thanks @mchaaler . |
…at they return pathlib objects instead of simple strings
…e of md5 hash check Fix issue smarie#34
Sure! |
Since filepaths are sometimes compared to filepaths stored in the Then fixing the not-failing-although-expected-to-fail bug (#34) was just a matter of adding the Let's check that and see if the CI builds are successful. |
src/mkdocs_gallery/gen_single.py
Outdated
# If expected to fail, let's assume it did when executed previously | ||
if script.src_py_file in script.gallery_conf['expected_failing_examples']: | ||
script.gallery_conf['failing_examples'][script.src_py_file] = ( | ||
"Due to MD5 check, script has not been actually executed - " | ||
"Assumed it failed as expected during previous execution." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be curious to see how this is done in sphinx-gallery
. Maybe there is an opportunity to suggest them a PR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed I did not check sphinx-gallery
before implementing the proposed solution.
It seems they handle this by using the gallery_conf['stale_examples']
list instead of the gallery_conf['failing_examples']
dict. I'm not familiar enough with the global process to evaluate the best approach. It seemed natural to me to use the 'failing_examples' entry, but maybe we should give it a try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mkdocs-gallery is really a copy of sphinx-gallery, I just modified a few design patterns (pathlib, objects) and made a few steps more readable, but I tried not to change the process at all.
The equivalent lines are here:
mkdocs-gallery/src/mkdocs_gallery/gen_single.py
Lines 963 to 980 in b2a6ccf
if not script.has_changed_wrt_persisted_md5(): | |
# A priori we can... | |
skip_and_return = True | |
# ...however for executables (not shared modules) we might need to run anyway because of config | |
if script.is_executable_example(): | |
if script.gallery_conf['run_stale_examples']: | |
# Run anyway because config says so. | |
skip_and_return = False | |
else: | |
# Add the example to the "stale examples" before returning | |
script.gallery_conf['stale_examples'].append(script.dwnld_py_file.as_posix()) | |
if skip_and_return: | |
# Return with 0 exec time and mem usage, and the existing thumbnail | |
thumb_source_path = script.get_thumbnail_source(file_conf) | |
thumb_file = create_thumb_from_image(script, thumb_source_path) | |
return GalleryScriptResults(script=script, intro=intro, exec_time=0., memory=0., thumb=thumb_file) |
So it is a bit strange, why the not modified failing sample is not added to stale samples in our case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh-oh ! it seems that there is an "as_posix" here ! :)
Let's check that:
|
…_code_block() itself and in called methods
Nice analysis @mchaaler ! I resolved the comment on src_file. |
I'm currently analyzing how it is done in Here's why:
... thus preventing the md5 file to ever be written for the failing or not executed scripts...
Indeed. We might at least ask if this approach has been chosen because they did not find a better way to handle expected-to-fail scripts. Since they set up the whole md5-check process to avoid re-executing scripts that did not change, it seems weird not to rely on it for all unmodified files. At the end, this means that my previous comment
is not accurate: the expected-to-fail scripts are not handled the way we thought in |
Thanks a lot for this analysis @mchaaler ! Well if this is correct, sphinx-gallery's current behaviour is definitely sub-optimal to me.
Let me know how do you want to proceed. We can define "the ideal fix" in this PR (probably relying on 'stale_sample' then?) so as to move on and release, and we can share it with them afterwards ; or we can open a discussion with them and find a common solution before implementing. On my side I see no hurry, so I am fine with either way. |
…skipped because of md5 hash check Fix issue smarie#34
I just pushed another commit (c61bec2) proposing an alternative to the fix. With 4d7baa9 we had:
And with c61bec2 we have:
Note the @smarie Let me know if you would qualify this approach as the "ideal fix"... |
Regarding @smarie May I add a comment in sphinx-gallery/sphinx-gallery#895 you created, to start the discussion about the choice they made in order to handle the expected-to-fail examples? |
Yes, it looks nice to me ! Let's merge this.
No, this is really not the case. It is rather "as many assert statements as needed", the main point is that the test should be focused on a single situation.
Indeed it is preferable. |
0.7.5 is now released, with the fix. Thanks a lot @mchaaler for all your work to solve these issues ! |
You're welcome! Proud to provide useful contributions and happy for the constructive feedback you gave. |
Fix issue #36