We need to check that a dependency is a build or test dependency before
checking that it is satisfied in order to prune dependencies as
requested correctly.
Before:
```
❯ brew deps esptool
ca-certificates
cmake
mpdecimal
openssl@1.1
openssl@3
pkg-config
python@3.11
readline
rust
six
sqlite
xz
```
After:
```
❯ brew deps esptool
ca-certificates
cffi
mpdecimal
openssl@1.1
pycparser
python@3.11
readline
six
sqlite
xz
```
Note: You will need build dependencies installed to reproduce the
"before" behaviour.
See #15445.