Use `.mkpath`:
```
(testpath/"usr/lib/cocaine").mkpath
...
```