def test_reading_writing_with_empty_description(tmpdir): """ Tests reading and writing with an empty description. """ filename = os.path.join(data_dir, "iteration_example.xml") new_filename = os.path.join(str(tmpdir), "iteration.xml") iteration = Iteration(filename) iteration.description = None # Write and read again. iteration.write(new_filename) reread_iteration = Iteration(new_filename) assert iteration == reread_iteration
def test_reading_writing_with_empty_description(tmpdir): """ Tests reading and writing with an empty description. """ filename = os.path.join(data_dir, "iteration_example.xml") new_filename = os.path.join(str(tmpdir), "iteration.xml") iteration = Iteration(filename, stf_fct=__stf_fct_dummy) iteration.description = None # Write and read again. iteration.write(new_filename) reread_iteration = Iteration(new_filename, stf_fct=__stf_fct_dummy) # Change the name as it is always dependent on the filename. reread_iteration.iteration_name = iteration.iteration_name assert iteration == reread_iteration
def test_reading_and_writing(tmpdir): """ Tests that reading and writing a file via IterationXML does not alter it. This effectively tests the Iteration XML writing. """ filename = os.path.join(data_dir, "iteration_example.xml") new_filename = os.path.join(str(tmpdir), "iteration.xml") iteration = Iteration(filename, stf_fct=__stf_fct_dummy) iteration.write(new_filename) # Compare the lxml etree's to avoid any difference in formatting and # what not. tree_old = etree.tounicode(etree.parse(filename), pretty_print=True) tree_new = etree.tounicode(etree.parse(new_filename), pretty_print=True) # pytest takes care of meaningful string differences. assert tree_old == tree_new