After you’ve built the local branch of your PR the current pip/conda environment would use this source build and you could execute the corresponding tests or test the PR in any other way.
I would probably not work in a Jupyter notebook to build PyTorch or what is the reason to trigger the build through the notebook?