Skip to content

Commit de8262b

Browse files
committed
Remove PYHELIOS_DEV_MODE from GitHub Actions workflows
- Clean up unused `PYHELIOS_DEV_MODE` environment variable from all workflows - Update pytest configurations to handle marker-based test skipping for platform-specific cases - Refactor tests to consolidate cross-platform and native-only testing patterns
1 parent e497b99 commit de8262b

8 files changed

Lines changed: 47 additions & 73 deletions

File tree

.github/workflows/test-linux.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,15 @@ jobs:
3737
pip install -e .
3838
3939
- name: Check PyHelios installation
40-
env:
41-
PYHELIOS_DEV_MODE: 1
4240
run: |
4341
python -c "import pyhelios; print('PyHelios imported successfully')"
4442
python -c "from pyhelios.plugins import print_plugin_status; print_plugin_status()"
4543
46-
- name: Run cross-platform tests (mock mode)
47-
env:
48-
PYHELIOS_DEV_MODE: 1
44+
- name: Run cross-platform tests
4945
run: |
5046
pytest tests/ -v -m "cross_platform or unit" --tb=short
5147
5248
- name: Run all tests including integration (expect skips for native tests)
53-
env:
54-
PYHELIOS_DEV_MODE: 1
5549
run: |
5650
pytest tests/ -v --tb=short
5751

.github/workflows/test-macos.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,15 @@ jobs:
3737
pip install -e .
3838
3939
- name: Check PyHelios installation
40-
env:
41-
PYHELIOS_DEV_MODE: 1
4240
run: |
4341
python -c "import pyhelios; print('PyHelios imported successfully')"
4442
python -c "from pyhelios.plugins import print_plugin_status; print_plugin_status()"
4543
46-
- name: Run cross-platform tests (mock mode)
47-
env:
48-
PYHELIOS_DEV_MODE: 1
44+
- name: Run cross-platform tests
4945
run: |
5046
pytest tests/ -v -m "cross_platform or unit" --tb=short
5147
5248
- name: Run all tests including integration (expect skips for native tests)
53-
env:
54-
PYHELIOS_DEV_MODE: 1
5549
run: |
5650
pytest tests/ -v --tb=short
5751

.github/workflows/test-matrix.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,23 @@ jobs:
4747
pip install -e .
4848
4949
- name: Verify PyHelios installation and platform detection
50-
env:
51-
PYHELIOS_DEV_MODE: 1
5250
run: |
5351
python -c "import pyhelios; print(f'PyHelios imported successfully on {pyhelios.__name__}')"
5452
python -c "from pyhelios.plugins import print_plugin_status; print_plugin_status()"
5553
5654
- name: Run cross-platform tests (should work on all platforms)
57-
env:
58-
PYHELIOS_DEV_MODE: 1
5955
run: |
6056
pytest tests/ -v -m "cross_platform" --tb=short
6157
62-
- name: Run unit tests (should work in mock mode)
63-
env:
64-
PYHELIOS_DEV_MODE: 1
58+
- name: Run unit tests
6559
run: |
6660
pytest tests/ -v -m "unit" --tb=short
6761
6862
- name: Run DataTypes tests (critical for cross-platform compatibility)
69-
env:
70-
PYHELIOS_DEV_MODE: 1
7163
run: |
7264
pytest tests/test_datatypes.py -v --tb=short
7365
7466
- name: Run full test suite (expect skips for native tests)
75-
env:
76-
PYHELIOS_DEV_MODE: 1
7767
run: |
7868
pytest tests/ -v --tb=short
7969

.github/workflows/test-quick.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,20 @@ jobs:
3030
pip install -e .
3131
3232
- name: Quick smoke test
33-
env:
34-
PYHELIOS_DEV_MODE: 1
3533
run: |
3634
python -c "import pyhelios; print('✓ PyHelios imports successfully')"
3735
python -c "from pyhelios.plugins import print_plugin_status; print_plugin_status()"
3836
3937
- name: Run essential tests only
40-
env:
41-
PYHELIOS_DEV_MODE: 1
4238
run: |
4339
# Run only the most critical tests for quick feedback
4440
pytest tests/test_datatypes.py -v --tb=short
4541
pytest tests/test_cross_platform.py -v -m "cross_platform" --tb=short
4642
4743
- name: Test basic functionality
48-
env:
49-
PYHELIOS_DEV_MODE: 1
5044
run: |
5145
python -c "
52-
# Test basic PyHelios functionality in mock mode
46+
# Test basic PyHelios functionality
5347
from pyhelios import Context, DataTypes
5448
5549
print('Testing Context creation...')

.github/workflows/test-required.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,22 @@ jobs:
3636
pip install -e .
3737
3838
- name: Verify PyHelios installation
39-
env:
40-
PYHELIOS_DEV_MODE: 1
4139
run: |
4240
python -c "import pyhelios; print(f'✓ PyHelios imported successfully')"
4341
python -c "from pyhelios.plugins import print_plugin_status; print_plugin_status()"
4442
4543
- name: Run essential cross-platform tests
46-
env:
47-
PYHELIOS_DEV_MODE: 1
4844
run: |
4945
pytest tests/test_datatypes.py -v --tb=short
5046
pytest tests/test_cross_platform.py -v -m "cross_platform" --tb=short
5147
52-
- name: Test core functionality in mock mode
53-
env:
54-
PYHELIOS_DEV_MODE: 1
48+
- name: Test core functionality
5549
run: |
5650
python -c "
5751
from pyhelios import Context, DataTypes
5852
from pyhelios.plugins import get_plugin_info
5953
60-
# Verify we start in mock mode (expected)
54+
# Check what mode we're in (native or mock)
6155
info = get_plugin_info()
6256
print(f'Platform: {info[\"platform\"]}')
6357
print(f'Mock mode: {info[\"is_mock\"]}')

tests/conftest.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,27 @@ def skip_if_no_native_library():
202202

203203
def expect_mock_mode_error():
204204
"""Expect a RuntimeError indicating mock mode."""
205-
return pytest.raises(RuntimeError, match="mock mode")
205+
return pytest.raises(RuntimeError, match="mock mode")
206+
207+
208+
def pytest_runtest_setup(item):
209+
"""Handle pytest marker-based test skipping."""
210+
# Skip native_only tests when running in mock mode
211+
if "native_only" in item.keywords:
212+
if not is_native_library_available():
213+
pytest.skip("Skipping native_only test - native library not available")
214+
215+
# Skip requires_dll tests when running in mock mode (legacy alias)
216+
if "requires_dll" in item.keywords:
217+
if not is_native_library_available():
218+
pytest.skip("Skipping requires_dll test - native library not available")
219+
220+
# Platform-specific skips
221+
if "windows_only" in item.keywords and not is_windows():
222+
pytest.skip("Skipping Windows-only test on non-Windows platform")
223+
224+
if "macos_only" in item.keywords and not is_macos():
225+
pytest.skip("Skipping macOS-only test on non-macOS platform")
226+
227+
if "linux_only" in item.keywords and not is_linux():
228+
pytest.skip("Skipping Linux-only test on non-Linux platform")

tests/test_external_geometry.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -312,18 +312,16 @@ class TestPrimitiveInfo:
312312

313313
def test_get_primitive_info_mock(self):
314314
"""Test getting primitive information with mocked data."""
315-
with patch.multiple(
316-
'pyhelios.Context.Context',
317-
getPrimitiveType=Mock(return_value=DataTypes.PrimitiveType.Triangle),
318-
getPrimitiveArea=Mock(return_value=0.5),
319-
getPrimitiveNormal=Mock(return_value=DataTypes.vec3(0, 0, 1)),
320-
getPrimitiveVertices=Mock(return_value=[
315+
with patch.object(Context, 'getPrimitiveType', return_value=DataTypes.PrimitiveType.Triangle), \
316+
patch.object(Context, 'getPrimitiveArea', return_value=0.5), \
317+
patch.object(Context, 'getPrimitiveNormal', return_value=DataTypes.vec3(0, 0, 1)), \
318+
patch.object(Context, 'getPrimitiveVertices', return_value=[
321319
DataTypes.vec3(0, 0, 0),
322-
DataTypes.vec3(1, 0, 0),
320+
DataTypes.vec3(1, 0, 0),
323321
DataTypes.vec3(0, 1, 0)
324-
]),
325-
getPrimitiveColor=Mock(return_value=DataTypes.RGBcolor(1, 0, 0))
326-
):
322+
]), \
323+
patch.object(Context, 'getPrimitiveColor', return_value=DataTypes.RGBcolor(1, 0, 0)):
324+
327325
context = Context()
328326

329327
info = context.getPrimitiveInfo(123)
@@ -384,20 +382,21 @@ class TestPrimitiveDataAPI:
384382
"""Test primitive data API (placeholders until C++ wrappers implemented)."""
385383

386384
def test_primitive_data_methods_not_implemented(self):
387-
"""Test that primitive data methods raise NotImplementedError."""
385+
"""Test that primitive data methods raise appropriate errors."""
388386
context = Context()
389387

390-
# All primitive data methods should raise NotImplementedError
391-
with pytest.raises(NotImplementedError):
388+
# In mock mode, these should raise RuntimeError about mock mode
389+
# In native mode without implementation, they should raise NotImplementedError
390+
with pytest.raises((NotImplementedError, RuntimeError)):
392391
context.setPrimitiveData(1, "test_key", 42)
393392

394-
with pytest.raises(NotImplementedError):
393+
with pytest.raises((NotImplementedError, RuntimeError)):
395394
context.getPrimitiveData(1, "test_key", int)
396395

397-
with pytest.raises(NotImplementedError):
396+
with pytest.raises((NotImplementedError, RuntimeError)):
398397
context.doesPrimitiveDataExist(1, "test_key")
399398

400-
with pytest.raises(NotImplementedError):
399+
with pytest.raises((NotImplementedError, RuntimeError)):
401400
context.getPrimitiveDataLabels(1)
402401

403402

tests/test_radiation_model.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
from pyhelios.RadiationModel import RadiationSourceType
1818

1919

20+
@pytest.mark.native_only
2021
class TestRadiationModel:
2122
"""Test RadiationModel class functionality"""
2223

23-
@pytest.mark.cross_platform
2424
def test_radiation_model_creation(self):
2525
"""Test RadiationModel creation and destruction"""
2626
with Context() as context:
@@ -37,7 +37,6 @@ def test_radiation_model_invalid_context(self):
3737
with pytest.raises(TypeError):
3838
RadiationModel("invalid_context")
3939

40-
@pytest.mark.cross_platform
4140
def test_message_control(self):
4241
"""Test message enable/disable functionality"""
4342
with Context() as context:
@@ -46,7 +45,6 @@ def test_message_control(self):
4645
radiation_model.disableMessages()
4746
radiation_model.enableMessages()
4847

49-
@pytest.mark.cross_platform
5048
def test_radiation_bands(self):
5149
"""Test radiation band management"""
5250
with Context() as context:
@@ -60,7 +58,6 @@ def test_radiation_bands(self):
6058
# Copy radiation band
6159
radiation_model.copyRadiationBand("SW", "SW_copy")
6260

63-
@pytest.mark.cross_platform
6461
def test_radiation_sources(self):
6562
"""Test radiation source creation"""
6663
with Context() as context:
@@ -89,7 +86,6 @@ def test_radiation_sources(self):
8986
spherical_dir, 1.0, 0.00935, 1.0)
9087
assert isinstance(source5, int)
9188

92-
@pytest.mark.cross_platform
9389
def test_radiation_source_invalid_direction(self):
9490
"""Test radiation source creation with invalid direction type"""
9591
with Context() as context:
@@ -110,7 +106,6 @@ def test_ray_count_configuration(self):
110106
# Set diffuse ray count
111107
radiation_model.setDiffuseRayCount("SW", 300)
112108

113-
@pytest.mark.cross_platform
114109
def test_flux_configuration(self):
115110
"""Test flux configuration"""
116111
with Context() as context:
@@ -132,7 +127,6 @@ def test_flux_configuration(self):
132127
flux = radiation_model.getSourceFlux(source, "SW")
133128
assert isinstance(flux, float)
134129

135-
@pytest.mark.cross_platform
136130
def test_flux_configuration_invalid_types(self):
137131
"""Test flux configuration with invalid types"""
138132
with Context() as context:
@@ -142,7 +136,6 @@ def test_flux_configuration_invalid_types(self):
142136
with pytest.raises(TypeError):
143137
radiation_model.setSourceFlux("invalid_source", "SW", 800.0)
144138

145-
@pytest.mark.cross_platform
146139
def test_scattering_configuration(self):
147140
"""Test scattering configuration"""
148141
with Context() as context:
@@ -155,7 +148,6 @@ def test_scattering_configuration(self):
155148
# Set minimum scatter energy
156149
radiation_model.setMinScatterEnergy("SW", 0.01)
157150

158-
@pytest.mark.cross_platform
159151
def test_emission_control(self):
160152
"""Test emission control"""
161153
with Context() as context:
@@ -168,7 +160,6 @@ def test_emission_control(self):
168160
# Enable emission
169161
radiation_model.enableEmission("SW")
170162

171-
@pytest.mark.cross_platform
172163
def test_geometry_update(self):
173164
"""Test geometry update"""
174165
with Context() as context:
@@ -182,7 +173,6 @@ def test_geometry_update(self):
182173
# Update specific geometry
183174
radiation_model.updateGeometry([patch])
184175

185-
@pytest.mark.cross_platform
186176
def test_run_simulation_basic(self):
187177
"""Test basic simulation execution (should not crash in mock mode)"""
188178
with Context() as context:
@@ -204,15 +194,13 @@ def test_run_simulation_basic(self):
204194
radiation_model.addRadiationBand("LW")
205195
radiation_model.runBand(["SW", "LW"])
206196

207-
@pytest.mark.cross_platform
208197
def test_run_simulation_invalid_types(self):
209198
"""Test simulation with invalid label types"""
210199
with Context() as context:
211200
with RadiationModel(context) as radiation_model:
212201
with pytest.raises(TypeError):
213202
radiation_model.runBand(123) # Invalid type
214203

215-
@pytest.mark.cross_platform
216204
def test_result_access(self):
217205
"""Test accessing simulation results"""
218206
with Context() as context:
@@ -234,10 +222,10 @@ def test_result_access(self):
234222
assert band_count >= 0
235223

236224

225+
@pytest.mark.native_only
237226
class TestContextPseudocolor:
238227
"""Test Context pseudocolor functionality"""
239228

240-
@pytest.mark.cross_platform
241229
def test_pseudocolor_basic(self):
242230
"""Test basic pseudocolor functionality"""
243231
with Context() as context:
@@ -256,7 +244,6 @@ def test_pseudocolor_basic(self):
256244
# Expected in mock mode when pseudocolor functions are not available
257245
pass
258246

259-
@pytest.mark.cross_platform
260247
def test_pseudocolor_with_range(self):
261248
"""Test pseudocolor with specified range"""
262249
with Context() as context:
@@ -275,7 +262,6 @@ def test_pseudocolor_with_range(self):
275262
# Expected in mock mode when pseudocolor functions are not available
276263
pass
277264

278-
@pytest.mark.cross_platform
279265
def test_pseudocolor_different_colormaps(self):
280266
"""Test different colormap options"""
281267
with Context() as context:

0 commit comments

Comments
 (0)