MCPcopy Create free account
hub / github.com/mlco2/codecarbon / test_doc_python_blocks

Function test_doc_python_blocks

tests/test_docs_examples.py:27–38  ·  view source on GitHub ↗

Test independent Python code blocks from docs. Each block runs in isolation (memory=False). CWD is changed to tmp_path to isolate any file I/O. Note: power-estimation.md contains code snippets that reference variables from the codebase; these are not standalone runnable examples.

(fpath, tmp_path, monkeypatch)

Source from the content-addressed store, hash-verified

25 ids=lambda p: Path(p).name,
26)
27def test_doc_python_blocks(fpath, tmp_path, monkeypatch):
28 """Test independent Python code blocks from docs.
29
30 Each block runs in isolation (memory=False).
31 CWD is changed to tmp_path to isolate any file I/O.
32
33 Note: power-estimation.md contains code snippets that reference
34 variables from the codebase; these are not standalone runnable examples.
35 """
36 monkeypatch.chdir(tmp_path)
37 abs_fpath = Path(__file__).parent.parent / fpath
38 check_md_file(str(abs_fpath))
39
40
41def test_first_tracking_tutorial(tmp_path, monkeypatch):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…