Skip to content

Commit f66e4f8

Browse files
committed
Revert "Fix importing fixtures across subfolders (spacetelescope#9545)"
This reverts commit 07f2649, reversing changes made to a4846d5.
1 parent b5d7188 commit f66e4f8

File tree

6 files changed

+14
-224
lines changed

6 files changed

+14
-224
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ jobs:
7272
- linux: py311-oldestdeps-xdist-cov
7373
- linux: py311-xdist
7474
- linux: py312-xdist
75-
- linux: py312-pyargs-xdist
7675
# `tox` does not currently respect `requires-python` versions when creating testing environments;
7776
# if this breaks, add an upper pin to `requires-python` and revert this py3 to the latest working version
7877
- linux: py3-cov-xdist

jwst/combine_1d/tests/test_combine1d.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,7 @@ def create_spec_model(npoints=10, flux=1e-9, error=1e-10, wave_range=(11, 13)):
205205
spec_model = datamodels.SpecModel(spec_table=otab)
206206

207207
return spec_model
208-
209-
210-
@pytest.fixture
211-
def wfss_multiexposure():
212-
return wfss_multi()
208+
213209

214210

215211
def test_wfss_multi_input(wfss_multiexposure):

jwst/datamodels/utils/tests/__init__.py

Whitespace-only changes.

jwst/datamodels/utils/tests/wfss_helpers.py

Lines changed: 0 additions & 164 deletions
This file was deleted.

jwst/extract_1d/tests/conftest.py

Lines changed: 12 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from jwst.exp_to_source import multislit_to_container
99

1010

11-
def simple_wcs_func():
11+
@pytest.fixture()
12+
def simple_wcs():
1213
"""
1314
Mock a horizontal dispersion WCS with a simple callable function.
1415
@@ -75,20 +76,6 @@ def return_results(*args, **kwargs): # noqa: ARG001
7576
return simple_wcs_function
7677

7778

78-
@pytest.fixture
79-
def simple_wcs():
80-
"""
81-
Make simple_wcs_func available as a fixture.
82-
83-
Returns
84-
-------
85-
callable
86-
A function that will return mock values for RA, Dec, wave,
87-
given x and y coordinates.
88-
"""
89-
return simple_wcs_func()
90-
91-
9279
@pytest.fixture()
9380
def simple_wcs_transpose():
9481
"""
@@ -192,12 +179,13 @@ def simple_wcs_function(x, y, z): # noqa: ARG001
192179
return simple_wcs_function
193180

194181

195-
def mock_nirspec_fs_one_slit_function():
182+
@pytest.fixture()
183+
def mock_nirspec_fs_one_slit(simple_wcs):
196184
"""
197185
Mock one slit in NIRSpec FS mode.
198186
199-
Returns
200-
-------
187+
Yields
188+
------
201189
SlitModel
202190
The mock model.
203191
"""
@@ -215,26 +203,12 @@ def mock_nirspec_fs_one_slit_function():
215203
model.source_type = "EXTENDED"
216204

217205
model.meta.wcsinfo.dispersion_direction = 1
218-
model.meta.wcs = simple_wcs_func()
206+
model.meta.wcs = simple_wcs
219207

220208
model.data = np.arange(50 * 50, dtype=float).reshape((50, 50))
221209
model.var_poisson = model.data * 0.02
222210
model.var_rnoise = model.data * 0.02
223211
model.var_flat = model.data * 0.05
224-
return model
225-
226-
227-
@pytest.fixture
228-
def mock_nirspec_fs_one_slit():
229-
"""
230-
Make mock_nirspec_fs_one_slit_function available as a fixture.
231-
232-
Yields
233-
------
234-
SlitModel
235-
The mock model.
236-
"""
237-
model = mock_nirspec_fs_one_slit_function()
238212
yield model
239213
model.close()
240214

@@ -476,12 +450,13 @@ def mock_miri_ifu(simple_wcs_ifu):
476450
model.close()
477451

478452

479-
def mock_nis_wfss_l2():
453+
@pytest.fixture()
454+
def mock_niriss_wfss_l2(mock_nirspec_fs_one_slit):
480455
"""
481456
Mock 3 slits in NIRISS WFSS mode, level 3 style.
482457
483-
Returns
484-
-------
458+
Yields
459+
------
485460
MultiSlitModel
486461
The mock model.
487462
"""
@@ -499,29 +474,13 @@ def mock_nis_wfss_l2():
499474
model.meta.observation.exposure_number = "5"
500475
model.meta.exposure.type = "NIS_WFSS"
501476

502-
slit0 = mock_nirspec_fs_one_slit_function()
503-
504477
nslit = 3
505478
for i in range(nslit):
506-
slit = slit0.copy()
479+
slit = mock_nirspec_fs_one_slit.copy()
507480
slit.name = str(i + 1)
508481
slit.meta.exposure.type = "NIS_WFSS"
509482
model.slits.append(slit)
510483

511-
return model
512-
513-
514-
@pytest.fixture
515-
def mock_niriss_wfss_l2():
516-
"""
517-
Make mock_nis_wfss_l2 available as a fixture.
518-
519-
Yields
520-
------
521-
MultiSlitModel
522-
The mock model.
523-
"""
524-
model = mock_nis_wfss_l2()
525484
yield model
526485
model.close()
527486

jwst/pipeline/tests/test_calwebb_spec3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from jwst.datamodels.utils.tests.wfss_helpers import wfss_multi
99

1010
from jwst.stpipe import Step
11-
from jwst.extract_1d.tests.conftest import mock_nis_wfss_l2
11+
from jwst.extract_1d.tests.conftest import mock_niriss_wfss_l2, mock_nirspec_fs_one_slit, simple_wcs
1212

1313

1414
INPUT_WFSS = "mock_wfss_cal.fits"

0 commit comments

Comments
 (0)