ENH: Make the code only run when not in test environment