I do not remove the cap anymore when I am pressing the brakes back into the caliper. I did this once a couple years ago. I was going to bleed the brakes lines at the same time, so I didn't remove the cap for the pressure aspect, just getting ready to bleed. But with the cap off, as I pressed the pistons back into the calipers, the force from the fluid coming back through the lines and into the master cylinder made fluid shoot out of the reservoir like a water fountain. It got all over my hood, firewall, inner fenders, and whatever else was under there. It sucks.
So my advice is to leave the cap on till you are done installing the brakes.
But one other thing you might want to consider is removing some fluid from the reservoir before you press them back in. I have also had a friends car where the garage must have checked his fluids, saw his brake fluid was a on the low side, and filled it up. I didn't realize this, and as we were pressing the pistons back into the calipers, the master cylinder overflowed from the excess brake fluid the shop added.
So I also advise to watch the level as you are doing this.