Skip to content

Commit

Permalink
Made manual testing easier by calling the test functions if a test mo…
Browse files Browse the repository at this point in the history
…dule is run from the command line.
  • Loading branch information
FlorianRhiem committed Nov 12, 2014
1 parent 6412b82 commit 4ac63c3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,14 @@ def test_calculate_bonds_memoization_with_explicit_param():
bonds = molecule.bonds
molecule.calculate_bonds(param=1.0)
assert molecule.bonds is bonds

if __name__ == '__main__':
test_calculate_bonds_with_default_method()
test_calculate_bonds_with_wrong_method()
test_calculate_bonds_with_radii_method()
test_calculate_bonds_with_constant_delta_method_with_default_param()
test_calculate_bonds_with_constant_delta_method_with_explicit_param()
test_calculate_bonds_empty()
test_calculate_bonds_memoization_with_other_method_or_param()
test_calculate_bonds_memoization_with_default_param()
test_calculate_bonds_memoization_with_explicit_param()
3 changes: 3 additions & 0 deletions tests/test_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ def test_draw():
mogli.draw(molecule)
# Close GR again
gr.emergencyclosegks()

if __name__ == '__main__':
test_draw()
3 changes: 3 additions & 0 deletions tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ def test_export():
molecule = mogli.read('examples/dna.xyz')[0]
mogli.export(molecule, 'test.html')
assert os.path.exists('test.html')

if __name__ == '__main__':
test_export()
5 changes: 5 additions & 0 deletions tests/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ def test_read_unknown_file():
"""
with pytest.raises(mogli.UnknownFileFormatException):
mogli.read('unknown')[0]

if __name__ == '__main__':
test_read_xyz_file()
test_read_xyz_file_and_get_atomic_radii()
test_read_unknown_file()
3 changes: 3 additions & 0 deletions tests/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ def alarm_handler(signal_number, stack_frame):
assert signal.alarm(1) == 0
# Show the molecule (and open the GLFW window closed by the alarm handler)
mogli.show(molecule)

if __name__ == '__main__':
test_show()

0 comments on commit 4ac63c3

Please sign in to comment.