I did this in my bathroom and stairway to check my wiring, and make sure I set up the 3-way switch correctly, etc.
I just pulled the switches and killed the power when I did the drywall. Then reinstalled the switches after. I think it's worth doing that way. Otherwise, you better HOPE the box depth is set EXACTLY right, or the switch will not be flush with the wall.