TST: avoid use of unsafe mktemp and cleanup test_dir in test_c_spec