Test/add xfel calibrate cli tests
Description
This MR adds in some basic tests for the CLI in xfel_calibrate. Done since I want to edit the CLI a bit for SQS Moonshot but the CLI is kinda spaghetti so I'm worried about breaking things and not realising it.
How Has This Been Tested?
Locally, tested by breaking code and checking that the tests fail.
Relevant Documents (optional)
Part of SQS Moonshot, see:
Types of changes
- Test (additional or refactored tests)
Checklist:
- My code follows the code style of this project.
Reviewers
Merge request reports
Activity
added In Progress label
changed milestone to %SQS Moonshot
- Resolved by Robert Rosca
- Resolved by Robert Rosca
- Resolved by Robert Rosca
- Resolved by Robert Rosca
added 8 commits
Toggle commit listmentioned in commit bd00649b
@kluyvert I've massacred this and turned it from a relatively simple use of pytest to something a fair bit more complex,
tests/test_xfel_calibrate/conftest.py
now contains some fixtures to make it (I think) easier and way more flexible to set up tests callingxfel-calibrate
in different ways.The actual implementation of the tests themselves hasn't changed, it's just nicer to set them up, e.g.:
class TestTutorialNotebook: @pytest.fixture(scope="function") def mock_proposal(self, tmp_path): return MockProposal(tmp_path, runs=4) @pytest.fixture(scope="function") def calibrate_call(self, mock_proposal: MockProposal, capsys, tmp_path): return CalibrateCall( tmp_path, capsys, out_folder=mock_proposal.path_proc, detector="Tutorial", cal_type="TEST", extra_args=["--runs", "1000"], )
And
class TestIntelliList: @pytest.fixture(scope="function") def mock_proposal(self, tmp_path): return MockProposal(tmp_path, runs=4) @pytest.fixture(scope="function") def calibrate_call(self, mock_proposal: MockProposal, capsys, tmp_path): return CalibrateCall( tmp_path, capsys, out_folder=mock_proposal.path_proc, detector="Tutorial", cal_type="TEST", extra_args=["--random-seed", "1,2,3-10"], )
And
class TestAgipdNotebook: @pytest.fixture(scope="function") def mock_proposal(self, tmp_path): return MockProposal(tmp_path, runs=4) @pytest.fixture(scope="function") def calibrate_call(self, mock_proposal: MockProposal, capsys, tmp_path): return CalibrateCall( tmp_path, capsys, in_folder=mock_proposal.path_raw, out_folder=mock_proposal.path_proc, detector="AGIPD", cal_type="CORRECT", extra_args=["--run", "0", "--sequences", "1-3"], )
With the way I did it before this kinda thing was a bit of a pain but now it's a tad smoother... I think/hope
You free to have another look some time?
added 2 commits
added 2 commits
added 2 commits
mentioned in commit 73e9b0cb
mentioned in commit 83a2792c