Skip to content

Commit 5fa206b

Browse files
committed
fix test setup in docs
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
1 parent e9b790d commit 5fa206b

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

  • python/packages/jumpstarter-driver-ridesx

python/packages/jumpstarter-driver-ridesx/README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,36 @@ Both drivers require:
103103

104104
## Usage Examples
105105

106+
```{testsetup} *
107+
from jumpstarter_driver_ridesx.driver import RideSXDriver, RideSXPowerDriver
108+
from jumpstarter_driver_pyserial.driver import PySerial
109+
from jumpstarter.common.utils import serve
110+
import tempfile
111+
112+
_ridesx_temp_dir = tempfile.mkdtemp()
113+
_ridesx_storage = serve(RideSXDriver(storage_dir=_ridesx_temp_dir, children={"serial": PySerial(url="loop://")}))
114+
_ridesx_power = serve(RideSXPowerDriver(children={"serial": PySerial(url="loop://")}))
115+
ridesx_client = _ridesx_storage.__enter__()
116+
ridesx_power_client = _ridesx_power.__enter__()
117+
```
118+
119+
```{testcleanup} *
120+
_ridesx_storage.__exit__(None, None, None)
121+
_ridesx_power.__exit__(None, None, None)
122+
import shutil
123+
shutil.rmtree(_ridesx_temp_dir, ignore_errors=True)
124+
```
125+
106126
### Flash Single Partition
107127

108-
```{testcode}
109-
# Flash a single partition
128+
```{code-block} python
129+
# Flash a single partition (paths must exist; flash runs fastboot on the exporter)
110130
ridesx_client.flash("/path/to/boot.img", target="boot")
111131
```
112132

113133
### Flash Multiple Partitions
114134

115-
```{testcode}
135+
```{code-block} python
116136
# Flash multiple partitions
117137
partitions = {
118138
"boot": "/path/to/boot.img",
@@ -126,7 +146,7 @@ ridesx_client.flash(partitions)
126146

127147
The driver automatically handles compressed images (`.gz`, `.gzip`, `.xz`):
128148

129-
```{testcode}
149+
```{code-block} python
130150
# Flash compressed images - decompression is automatic
131151
ridesx_client.flash("/path/to/boot.img.gz", target="boot")
132152
```

0 commit comments

Comments
 (0)