Skip to content

Commit

Permalink
Pytest without simulation results for github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gschlafly committed Jun 5, 2024
1 parent ec949f7 commit 6bb7cc7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
pip install -e .[test]
- name: Test with pytest
run: |
pytest
pytest -m "not slow"
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
5 changes: 4 additions & 1 deletion tests/test_simulation_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from VolumeRaytraceLFM.abstract_classes import BackEnds
from VolumeRaytraceLFM.birefringence_implementations import BirefringentVolume
from VolumeRaytraceLFM.volumes import volume_args
from tests.test_all import check_azimuth_images
from tests.fixtures_optical_info import set_optical_info

BACKEND = BackEnds.PYTORCH
Expand Down Expand Up @@ -58,7 +59,7 @@ def compare_images(generated_images, saved_images):
assert torch.allclose(
generated_images[0], saved_images[0]
), "Retardance images differ"
assert torch.allclose(generated_images[1], saved_images[1]), "Azimuth images differ"
check_azimuth_images(generated_images[1], saved_images[1])
print("Images match the saved images.")


Expand All @@ -72,8 +73,10 @@ def compare_images(generated_images, saved_images):
("shell_small", [7, 18, 18], 16, 9),
],
)
@pytest.mark.slow
def test_simulation(vol_type, vol_shape, pixels_per_ml, n_lenslets):
torch.set_default_dtype(torch.float32)
torch.set_grad_enabled(False)
images = run_simulation(vol_type, vol_shape, pixels_per_ml, n_lenslets)
filename = generate_filename(vol_type, vol_shape, pixels_per_ml, n_lenslets)
filepath = f"tests/test_data/{filename}"
Expand Down

0 comments on commit 6bb7cc7

Please sign in to comment.