Skip to content

Commit e5c58a8

Browse files
bottlerfacebook-github-bot
authored andcommitted
Test website metadata
Summary: New test that notes and tutorials are listed in the website metadata, so that they will be included in the website build. Reviewed By: nikhilaravi Differential Revision: D30223799 fbshipit-source-id: 2dca9730b54e68da2fd430a7b47cb7e18814d518
1 parent 64faedf commit e5c58a8

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/test_build.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,35 @@ def test_valid_ipynbs(self):
7474
for tutorial in tutorials:
7575
with open(tutorial) as f:
7676
json.load(f)
77+
78+
@unittest.skipIf(in_conda_build or in_re_worker, "In conda build, or RE worker")
79+
def test_enumerated_ipynbs(self):
80+
# Check that the tutorials are all referenced in tutorials.json.
81+
root_dir = get_pytorch3d_dir()
82+
tutorials_dir = root_dir / "docs" / "tutorials"
83+
tutorials_on_disk = sorted(i.stem for i in tutorials_dir.glob("*.ipynb"))
84+
85+
json_file = root_dir / "website" / "tutorials.json"
86+
with open(json_file) as f:
87+
cfg_dict = json.load(f)
88+
listed_in_json = []
89+
for section in cfg_dict.values():
90+
listed_in_json.extend(item["id"] for item in section)
91+
92+
self.assertListEqual(sorted(listed_in_json), tutorials_on_disk)
93+
94+
@unittest.skipIf(in_conda_build or in_re_worker, "In conda build, or RE worker")
95+
def test_enumerated_notes(self):
96+
# Check that the notes are all referenced in sidebars.json.
97+
root_dir = get_pytorch3d_dir()
98+
notes_dir = root_dir / "docs" / "notes"
99+
notes_on_disk = sorted(i.stem for i in notes_dir.glob("*.md"))
100+
101+
json_file = root_dir / "website" / "sidebars.json"
102+
with open(json_file) as f:
103+
cfg_dict = json.load(f)
104+
listed_in_json = []
105+
for section in cfg_dict["docs"].values():
106+
listed_in_json.extend(section)
107+
108+
self.assertListEqual(sorted(listed_in_json), notes_on_disk)

0 commit comments

Comments
 (0)