File size: 1,719 Bytes
5301c48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
[pytest]
# This is the main section header for pytest configurations.

testpaths = .
# Tells pytest to search for tests starting from the directory where pytest.ini is located (the 'tests' directory in your case) and its subdirectories.

python_files = test_*.py
# A pattern for test discovery. Pytest will consider Python files starting with 'test_' and ending with '.py' as files that might contain tests.
# This is how it finds your 'tests/test_notebooks.py'.

python_functions = test_*
# Within the discovered Python files (like test_notebooks.py), pytest will look for functions that start with 'test_' and consider them as individual test functions.
# This is how it identifies 'test_notebook_execution' in 'test_notebooks.py'.

markers =
    notebook: marks tests as notebook tests
# This defines a custom marker named 'notebook'.
# - The name before the colon ('notebook') is what you use in your code (e.g., @pytest.mark.notebook).
# - The text after the colon ('marks tests as notebook tests') is a description that appears if you run 'pytest --markers'.
# Markers help you categorize tests and can be used to selectively run or skip tests (e.g., 'pytest -m notebook').

addopts = --nbval-lax
# 'addopts' stands for "additional options". These are command-line options that pytest will automatically apply every time it runs.
# In this case, '--nbval-lax' is an option specifically for the 'nbval' plugin.
# It tells 'nbval' to run in "lax" mode:
#   - Execute all cells in the notebook.
#   - The test passes if all cells execute without raising any Python exceptions.
#   - It does NOT compare the output of cells to any stored "expected" output. This is key for your goal of just checking if notebooks run.