GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Numerics-Python-Examples/tests/test_validation_cli.py at main · USACE-RMC/Numerics-Python-Examples

Expand file tree

/

test_validation_cli.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
36 lines (29 loc) · 1.37 KB
/

test_validation_cli.py

Copy path

File metadata and controls

36 lines (29 loc) · 1.37 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from pathlib import Path
import subprocess
import sys
import tempfile
ROOT = Path(__file__).resolve().parents[1]
def test_unknown_notebook_number_is_not_a_successful_empty_validation():
result = subprocess.run(
[sys.executable, str(ROOT / "scripts" / "validate_examples.py"),
"--notebooks", "99", "--schema-only"],
cwd=ROOT, capture_output=True, text=True, timeout=30,
)
assert result.returncode != 0
assert "Unknown notebook numbers: 99" in result.stderr
def test_schema_check_does_not_erase_existing_execution_receipt(monkeypatch):
import nbformat
from scripts import validate_examples
with tempfile.TemporaryDirectory() as temporary:
directory = Path(temporary)
notebooks = directory / "notebooks"
notebooks.mkdir()
nbformat.write(nbformat.v4.new_notebook(), notebooks / "00_sample.ipynb")
artifacts = directory / "artifacts" / "validation"
artifacts.mkdir(parents=True)
receipt = artifacts / "results-all.json"
receipt.write_text('[{"status": "passed", "seconds": 12.3}]', encoding="utf-8")
monkeypatch.setattr(validate_examples, "ROOT", directory)
monkeypatch.setattr(sys, "argv", ["validate_examples.py", "--schema-only"])
validate_examples.main()
assert receipt.read_text(encoding="utf-8") == '[{"status": "passed", "seconds": 12.3}]'
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.