@@ -6,30 +6,84 @@ This directory contains integration tests for the nb-cli tool's local mode opera
66
77```
88tests/
9- ├── integration_local_mode.rs # Main integration test suite
9+ ├── integration_local_mode.rs # Core CLI operations (no execution)
10+ ├── integration_execution.rs # Execution tests (requires Python)
11+ ├── test_helpers.rs # Test utilities and venv setup
12+ ├── setup_test_env.sh # Script to setup test environment
1013├── fixtures/ # Test notebook fixtures
11- │ ├── empty.ipynb # Empty notebook with no cells
12- │ ├── basic.ipynb # Basic notebook with one empty cell
13- │ ├── with_code.ipynb # Notebook with code cells
14- │ ├── mixed_cells.ipynb # Notebook with mixed cell types
15- │ └── with_outputs.ipynb # Notebook with cell outputs
14+ │ ├── empty.ipynb # Empty notebook with no cells
15+ │ ├── basic.ipynb # Basic notebook with one empty cell
16+ │ ├── with_code.ipynb # Notebook with code cells
17+ │ ├── mixed_cells.ipynb # Notebook with mixed cell types
18+ │ ├── with_outputs.ipynb # Notebook with cell outputs
19+ │ ├── for_execution.ipynb # Simple execution test notebook
20+ │ └── with_error.ipynb # Notebook with error cell
21+ ├── .test-venv/ # Test virtual environment (auto-created)
1622└── README.md # This file
1723```
1824
1925## Running Tests
2026
21- Run all integration tests:
27+ ### Setup (One Time)
28+
29+ For execution tests, you need to setup the Python environment:
30+
31+ ``` bash
32+ # Option 1: Use the setup script (requires uv)
33+ ./tests/setup_test_env.sh
34+
35+ # Option 2: Manual setup
36+ uv venv tests/.test-venv
37+ tests/.test-venv/bin/pip install nbclient nbformat ipykernel
38+ ```
39+
40+ ** Note** : If you don't have ` uv ` installed:
41+ ``` bash
42+ curl -LsSf https://astral.sh/uv/install.sh | sh
43+ ```
44+
45+ ### Run All Tests
46+
47+ Run all integration tests (both local and execution):
48+ ``` bash
49+ cargo test
50+ ```
51+
52+ ### Run Specific Test Suites
53+
54+ Run only local mode tests (no Python required):
2255``` bash
2356cargo test --test integration_local_mode
2457```
2558
26- Run specific tests:
59+ Run only execution tests (requires Python venv):
60+ ``` bash
61+ cargo test --test integration_execution
62+ ```
63+
64+ ### Run Specific Tests
65+
2766``` bash
2867cargo test --test integration_local_mode test_create_empty_notebook
29- cargo test --test integration_local_mode test_add_cell
68+ cargo test --test integration_execution test_execute_single_cell
3069```
3170
32- Run tests with output:
71+ ### Run with Output
72+
3373``` bash
3474cargo test --test integration_local_mode -- --nocapture
75+ cargo test --test integration_execution -- --nocapture
76+ ```
77+
78+ ### Execution Tests Behavior
79+
80+ Execution tests will automatically:
81+ - ✅ ** Skip gracefully** if Python environment is not set up
82+ - ✅ ** Auto-create venv** with ` uv ` if available
83+ - ✅ ** Install dependencies** (nbclient, nbformat, ipykernel)
84+ - ✅ ** Use isolated environment** (tests/.test-venv)
85+
86+ If execution tests are skipped, you'll see:
87+ ```
88+ ⚠️ Skipping test: execution environment not available
3589```
0 commit comments