-
Notifications
You must be signed in to change notification settings - Fork 5
test: Run tutorials in tests #45
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
Changes from all commits
c58bb59
7cb8a66
86d91e8
c8883e8
199630b
b40a87f
c7b94c4
9490394
e3d5cff
5a1091a
ba6825a
eb8cab3
b77fb30
9b7c4c2
b8822b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| **Added:** | ||
|
|
||
| * Add tests that run PDF example scripts | ||
|
|
||
| **Changed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Deprecated:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Removed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Fixed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Security:** | ||
|
|
||
| * <news item> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| ipywidgets | ||
| matplotlib | ||
| ipympl | ||
| bg-mpl-stylesheets | ||
| py3dmol>=2.0.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,5 @@ pytest-env | |
| pytest-mock | ||
| freezegun | ||
| DeepDiff | ||
| psutil | ||
| bg-mpl-stylesheets | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import runpy | ||
|
|
||
|
|
||
| def test_all_examples(tmp_examples): | ||
| """Run all example scripts to ensure they execute without error.""" | ||
| scripts = list(tmp_examples.rglob("**/solutions/diffpy-cmi/*.py")) | ||
| # sort list so that fitBulkNi.py runs first | ||
| scripts.sort(key=lambda s: 0 if s.name == "fitBulkNi.py" else 1) | ||
| for script in scripts: | ||
| script_relative_path = script.relative_to(tmp_examples).as_posix() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is your reason for the posix? this is likely to make it not work on windows. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sbillinge This is to make it compatible across operating systems when converting the path to a string. Maybe it can go either way here (use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would just delete it tbh There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. Will do |
||
| print("hello", script_relative_path) | ||
| print(f"Testing {script_relative_path}") | ||
| runpy.run_path(str(script), run_name="__main__") | ||
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.
where is the group style added back in?
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.
@sbillinge I will have to add it to each file I think, I can do this!
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.
better on another PR, but can we also do this work on the examples scripts also? Not just the solutions?
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.
@sbillinge Yeah I can do this. Do you want me to revert back then?