Hi,
For random ad-hoc debugging like pdb
one possible way is to use nix-shell
to get an interactive and isolated environment going. For this you could use the existing derivations from nixpkgs.
One small caveat with this is that such a derivation usually requires minor adjustments as they depend on being called other parts of nixpkgs (I am not aware of an automatic/out of the box method to do that), but often it’s enough to replace the argument list with with import <nixpkgs>{};
Once you are dropped into the resulting shell, you should be able to invoke the code and tests manually etc.
Edit: There is also a useful thread about nix-shell workflows: What is the best dev workflow around nix-shell?