Skip to content

Commit 606ce2b

Browse files
committed
Switch scope to module instead of session for reader dummy files
1 parent ee97b2f commit 606ce2b

File tree

6 files changed

+30
-24
lines changed

6 files changed

+30
-24
lines changed

satpy/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ def pytest_unconfigure(config):
3737
def session_tmp_path(tmp_path_factory: pytest.TempPathFactory) -> Path:
3838
"""Generate a single temp path to use for the entire session."""
3939
return tmp_path_factory.mktemp("data")
40+
41+
42+
@pytest.fixture(scope="module")
43+
def module_tmp_path(tmp_path_factory: pytest.TempPathFactory) -> Path:
44+
"""Generate a single temp path to use for the entire session."""
45+
return tmp_path_factory.mktemp("data")

satpy/tests/reader_tests/test_geocat.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@
3535
DEFAULT_LON_DATA = np.repeat([DEFAULT_LON_DATA], DEFAULT_FILE_SHAPE[0], axis=0)
3636

3737

38-
@pytest.fixture(scope="session")
39-
def g13_file(session_tmp_path: Path) -> Path:
38+
@pytest.fixture(scope="module")
39+
def g13_file(module_tmp_path: Path) -> Path:
4040
"""Create a GOES 13 geocat file."""
4141
platform_shortname = "GOES-13"
42-
filename = session_tmp_path / "geocatL2.GOES-13.2015143.234500.nc"
42+
filename = module_tmp_path / "geocatL2.GOES-13.2015143.234500.nc"
4343
return _create_geocat_file(filename, platform_shortname)
4444

4545

46-
@pytest.fixture(scope="session")
47-
def h8_file(session_tmp_path: Path) -> Path:
46+
@pytest.fixture(scope="module")
47+
def h8_file(module_tmp_path: Path) -> Path:
4848
"""Create a HIMAWARI 8 geocat file."""
4949
platform_shortname = "HIMAWARI-8"
50-
filename = session_tmp_path / "geocatL2.HIMAWARI-8.2017092.210730.R304.R20.nc"
50+
filename = module_tmp_path / "geocatL2.HIMAWARI-8.2017092.210730.R304.R20.nc"
5151
return _create_geocat_file(filename, platform_shortname)
5252

5353

54-
@pytest.fixture(scope="session")
55-
def g17_file(session_tmp_path: Path) -> Path:
54+
@pytest.fixture(scope="module")
55+
def g17_file(module_tmp_path: Path) -> Path:
5656
"""Create a GOES 17 geocat file."""
57-
filename = session_tmp_path / "geocatL2.GOES-17.CONUS.2020041.163130.hdf"
57+
filename = module_tmp_path / "geocatL2.GOES-17.CONUS.2020041.163130.hdf"
5858
return _create_geocat_file(filename, platform_shortname="GOES-17")
5959

6060

satpy/tests/reader_tests/test_mimic_TPW2_lowres.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
ubyte_variables = ["satGridPrior", "satGridSubseq"]
4242

4343

44-
@pytest.fixture(scope="session")
45-
def mimic_file(session_tmp_path: Path) -> Path:
44+
@pytest.fixture(scope="module")
45+
def mimic_file(module_tmp_path: Path) -> Path:
4646
"""Mimic a real data file."""
47-
filename = session_tmp_path / "comp20190619.130000.nc"
47+
filename = module_tmp_path / "comp20190619.130000.nc"
4848
file_type = "mimicTPW2_comp"
4949
dt_s = DEFAULT_DATE
5050
dt_e = DEFAULT_DATE

satpy/tests/reader_tests/test_mimic_TPW2_nc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
dtype=DEFAULT_FILE_DTYPE).reshape(DEFAULT_FILE_SHAPE)
3737

3838

39-
@pytest.fixture(scope="session")
40-
def mimic_file(session_tmp_path: Path) -> Path:
39+
@pytest.fixture(scope="module")
40+
def mimic_file(module_tmp_path: Path) -> Path:
4141
"""Mimic a real data file."""
42-
filename = session_tmp_path / "comp20190619.130000.nc"
42+
filename = module_tmp_path / "comp20190619.130000.nc"
4343
dt_s = datetime(2019, 6, 19, 13, 0)
4444
dt_e = datetime(2019, 6, 19, 13, 0)
4545

satpy/tests/reader_tests/test_smos_l2_wind.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
import xarray as xr
2727

2828

29-
@pytest.fixture(scope="session")
30-
def smos_l2_file(session_tmp_path):
29+
@pytest.fixture(scope="module")
30+
def smos_l2_file(module_tmp_path):
3131
"""Create a real dummy file for testing."""
32-
filename = session_tmp_path / "SM_OPER_MIR_SCNFSW_20200420T021649_20200420T035013_110_001_7.nc"
32+
filename = module_tmp_path / "SM_OPER_MIR_SCNFSW_20200420T021649_20200420T035013_110_001_7.nc"
3333
file_content = xr.DataTree()
3434

3535

satpy/tests/reader_tests/test_tropomi_l2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ def tropomi_base_data() -> xr.DataTree:
6363
return ds
6464

6565

66-
@pytest.fixture(scope="session")
67-
def tropomi_no2_file(session_tmp_path: Path) -> Path:
66+
@pytest.fixture(scope="module")
67+
def tropomi_no2_file(module_tmp_path: Path) -> Path:
6868
"""Create a NO2 tropomi file."""
69-
fn = session_tmp_path / "S5P_OFFL_L2__NO2____20180709T170334_20180709T184504_03821_01_010002_20180715T184729.nc"
69+
fn = module_tmp_path / "S5P_OFFL_L2__NO2____20180709T170334_20180709T184504_03821_01_010002_20180715T184729.nc"
7070
ds = tropomi_base_data()
7171
ds["/PRODUCT/nitrogen_dioxide_total_column"] = xr.DataArray(DEFAULT_FILE_DATA, dims=("scanline", "ground_pixel"))
7272
ds["/PRODUCT/nitrogen_dioxide_total_column"].attrs["_FillValue"] = -999.0
@@ -75,10 +75,10 @@ def tropomi_no2_file(session_tmp_path: Path) -> Path:
7575
return fn
7676

7777

78-
@pytest.fixture(scope="session")
79-
def tropomi_so2_file(session_tmp_path: Path) -> Path:
78+
@pytest.fixture(scope="module")
79+
def tropomi_so2_file(module_tmp_path: Path) -> Path:
8080
"""Create a SO2 tropomi file."""
81-
fn = session_tmp_path / "S5P_OFFL_L2__SO2____20180709T170334_20180709T184504_03821_01_010002_20180715T184729.nc"
81+
fn = module_tmp_path / "S5P_OFFL_L2__SO2____20180709T170334_20180709T184504_03821_01_010002_20180715T184729.nc"
8282
ds = tropomi_base_data()
8383
ds["/PRODUCT/sulfurdioxide_total_vertical_column"] = xr.DataArray(DEFAULT_FILE_DATA,
8484
dims=("scanline", "ground_pixel"))

0 commit comments

Comments
 (0)