def test_write_orbitize_input(): """ Test the write_orbitize_input and the read_file functions """ input_file = os.path.join(orbitize.DATADIR, 'test_val.csv') test_table = read_file(input_file) output_file = os.path.join(orbitize.DATADIR, 'temp_test_orbitize_input.csv') # If temp output file already exists, delete it if os.path.isfile(output_file): os.remove(output_file) try: # Catch these tests so that we remove temporary file # Test that we were able to write the table write_orbitize_input(test_table, output_file) assert os.path.isfile(output_file) # Test that we can read the table and check if it's correct test_table_2 = read_file(output_file) _compare_table(test_table_2) finally: # Remove temporary file os.remove(output_file)
def test_write_orbitize_input_2(): """ Test the write_orbitize_input and the read_orbitize_input functions This test exists with the fail_if_not_removed decorator as a reminder to remove in v2.0 """ testdir = os.path.dirname(os.path.abspath(__file__)) input_file = os.path.join(testdir, 'test_val.csv') test_table = read_file(input_file) output_file = os.path.join(testdir, 'temp_test_orbitize_input.csv') # If temp output file already exists, delete it if os.path.isfile(output_file): os.remove(output_file) try: # Catch these tests so that we remove temporary file # Test that we were able to write the table write_orbitize_input(test_table,output_file) assert os.path.isfile(output_file) # Test that we can read the table and check if it's correct test_table_2 = read_orbitize_input(output_file) _compare_table(test_table_2) finally: # Remove temporary file os.remove(output_file)