TST: make pytables tests go thru a temporary dir and file
TST/BUG: incorrect way of testing for r+ modes

related #5419

I just fixed the merge conflict on the related PR. Once it passes I'll merge it and then you can do this one. Sound good?
 except don't put in any of the hdf stuff (or I can merge this first)
 ok let me move this pr to your branch u can incorporate and merge all together
 closing in favor of #5419
