-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull notebook classification out into separate test (#1397)
We want to run the notebook classification check on every PR. This PR pulls that test out into a separate pytest suite and runs it as part of the standard CI job. I'd like to also add some more tests to this suite as the `nb-tester` has grown in complexity and there were some issues with it recently.
- Loading branch information
1 parent
b33b59f
commit be977b1
Showing
6 changed files
with
43 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from types import SimpleNamespace | ||
from pathlib import Path | ||
|
||
from qiskit_docs_notebook_tester import Config, matches | ||
|
||
|
||
def test_all_notebooks_are_classified(): | ||
args = SimpleNamespace( | ||
filenames=None, | ||
write=False, | ||
submit_jobs=True, | ||
config_path="scripts/nb-tester/notebooks.toml" | ||
) | ||
|
||
config = Config.from_args(args) | ||
|
||
|
||
unclassified = [ | ||
path for path in Path(".").glob("[!.]*/**/*.ipynb") | ||
if not matches(path, config.all_notebooks) | ||
] | ||
|
||
message = ( | ||
f"\nThe following notebooks are not classified in {args.config_path}:\n " | ||
+ "\n ".join(map(str, unclassified)) | ||
+ "\nAdd them to the appropriate group so we know how to test them.\n" | ||
) | ||
|
||
assert unclassified == [], message |
This file contains 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