Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
sphuber committed Jul 7, 2023
1 parent 9f548cb commit 3888ab8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/cmdline/commands/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,15 @@ def mock_check_output(options):
assert isinstance(options, list)
assert options[0] == fmt

def mock_pyplot_show(*_args, **_kwargs):
pass

# This is called by the ``_show_jmol`` and ``_show_xcrysden`` implementations. We want to test just the function
# but not the actual commands through a sub process.
monkeypatch.setattr(sp, 'check_output', mock_check_output)

# This will be called by ``_show_mpl_pos`` which will actually open a window, causing the tests to hang.
monkeypatch.setattr(pyplot, 'show', lambda *args, **kwargs: None)
monkeypatch.setattr(pyplot, 'show', mock_pyplot_show)

options = ['--format', fmt, str(self.pks[DummyVerdiDataListable.NODE_ID_STR])]
run_cli_command(cmd_trajectory.trajectory_show, options, use_subprocess=False)
Expand Down

0 comments on commit 3888ab8

Please sign in to comment.