|
34 | 34 |
|
35 | 35 | REQS = ROOT / "requirements" |
36 | 36 | BINDER = ROOT / "binder" |
| 37 | +BINDER_ENV = BINDER / "environment.yml" |
37 | 38 |
|
38 | 39 | # docs |
39 | 40 | MAIN_README = ROOT / "README.md" |
40 | 41 | CHANGELOG = ROOT / "CHANGELOG.md" |
| 42 | +CONTRIBUTING = ROOT / "CONTRIBUTING.md" |
41 | 43 |
|
42 | 44 | # TS stuff |
43 | 45 | NPM_NS = "@krassowski" |
@@ -87,6 +89,16 @@ def the_meta_package(): |
87 | 89 | ) |
88 | 90 |
|
89 | 91 |
|
| 92 | +@pytest.fixture(scope="module") |
| 93 | +def the_contributing_doc(): |
| 94 | + return CONTRIBUTING.read_text(encoding="utf-8") |
| 95 | + |
| 96 | + |
| 97 | +@pytest.fixture(scope="module") |
| 98 | +def the_binder_env(): |
| 99 | + return yaml.safe_load(BINDER_ENV.read_text(encoding="utf-8")) |
| 100 | + |
| 101 | + |
90 | 102 | @pytest.fixture(scope="module") |
91 | 103 | def the_installation_notebook(): |
92 | 104 | """executes and loads up the installation notebook""" |
@@ -185,9 +197,35 @@ def test_changelog_versions(pkg, version): |
185 | 197 | ], |
186 | 198 | ) |
187 | 199 | def test_installation_versions(the_installation_notebook, pkg, sep, version, expected): |
| 200 | + """are the first-party versions consistent with the package metadata?""" |
188 | 201 | assert the_installation_notebook.count(f"{pkg}{sep}{version}") == expected |
189 | 202 |
|
190 | 203 |
|
| 204 | +@pytest.mark.parametrize( |
| 205 | + "pkg,count", |
| 206 | + [ |
| 207 | + ["python", 2], |
| 208 | + ["nodejs", 4], |
| 209 | + # ["jupyterlab", 2], # this is handled through template variables |
| 210 | + ], |
| 211 | +) |
| 212 | +def test_installation_env_versions( |
| 213 | + the_installation_notebook, the_binder_env, pkg, count |
| 214 | +): |
| 215 | + """are the third-party versions consistent with the binder?""" |
| 216 | + for spec in the_binder_env["dependencies"]: |
| 217 | + if isinstance(spec, str) and spec.startswith(f"{pkg} "): |
| 218 | + assert the_installation_notebook.count(spec) == count |
| 219 | + |
| 220 | + |
| 221 | +@pytest.mark.parametrize("pkg", ["python", "jupyterlab", "nodejs"]) |
| 222 | +def test_contributing_versions(the_contributing_doc, the_binder_env, pkg): |
| 223 | + """are the documented contributing requirements consistent with binder?""" |
| 224 | + for spec in the_binder_env["dependencies"]: |
| 225 | + if isinstance(spec, str) and spec.startswith(f"{pkg} "): |
| 226 | + assert spec in the_contributing_doc |
| 227 | + |
| 228 | + |
191 | 229 | def check_integrity(): |
192 | 230 | """actually run the tests""" |
193 | 231 | args = ["-vv", __file__] |
|
0 commit comments