I'm doing a bathroom reno and will be removing the bathtub and shower, and they will be out for quite some time. Because of this, I want to cap off the 1.5" and 2" PVC drain pipes (rather than stuff a towel in them or something similar). Can I simply put a PVC cap on without any solvent, or will that leak sewer gasses?
Yes. DWV pipe caps fit quite snugly, without glue, and will not pass any detectable amount of vent gases. You had better be sure that those drain lines will never be subject to filling with waste water, condensation, etc. If you're planning to glue-up some new drain/vent piping as part of your project, you'll be needing something like expansion plugs to properly water-test your work, and those will work excellent as temporary pipe plugs.
Oatey makes a number of "Gripper" plugs for many sizes of pipe and fittings. I have seen them available in big-box stores. There is a gasket and a screw you turn to tighten the plug into the end of the pipe/fitting, it is air/pressure tight (to a point) and it can be easily removed later.