• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

johntruckenbrodt / pyroSAR / 21948031762

12 Feb 2026 01:12PM UTC coverage: 54.886% (+0.3%) from 54.605%
21948031762

push

github

web-flow
Merge pull request #393 from johntruckenbrodt/cicd/tmp_home_autouse

[tests] session scope for tmp_home fixture

99 of 115 new or added lines in 4 files covered. (86.09%)

3 existing lines in 1 file now uncovered.

4134 of 7532 relevant lines covered (54.89%)

0.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.91
/tests/conftest.py
1
import os
1✔
2
import shutil
1✔
3
import pytest
1✔
4
import platform
1✔
5
from pathlib import Path
1✔
6
from pyroSAR.examine import ExamineSnap
1✔
7

8

9
@pytest.fixture
1✔
10
def travis():
1✔
11
    return 'TRAVIS' in os.environ.keys()
1✔
12

13

14
@pytest.fixture
1✔
15
def appveyor():
1✔
16
    return 'APPVEYOR' in os.environ.keys()
×
17

18

19
@pytest.fixture
1✔
20
def testdir():
1✔
21
    return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
1✔
22

23

24
@pytest.fixture
1✔
25
def testdata(testdir):
1✔
26
    out = {
1✔
27
        # ASAR_IMS__A_20040703T205338, product: SLC, driver: ESA
28
        'asar': os.path.join(testdir,
29
                             'ASA_IMS_1PNESA20040703_205338_000000182028_00172_12250_00001672562030318361237.N1'),
30
        # ERS1_IMP__A_19960808T205906, product: PRI, driver: ESA
31
        'ers1_esa': os.path.join(testdir, 'SAR_IMP_1PXESA19960808_205906_00000017G158_00458_26498_2615.E1'),
32
        # ERS1_IMS__D_19951220T024320, product: SLC, driver: CEOS_ERS
33
        'ers1_ceos': os.path.join(testdir, 'SAR_IMS_1PXESA19951220_024320_00000015G152_00132_23166_0252.E1.zip'),
34
        # PSR2_FBD__A_20140909T043342, product: 1.5, driver: CEOS_PSR
35
        'psr2': os.path.join(testdir, '0000022708_001001_ALOS2015976960-140909.zip'),
36
        # main scene for testing Sentinel-1 metadata reading and database ingestion
37
        's1': os.path.join(testdir, 'S1A_IW_GRDH_1SDV_20150222T170750_20150222T170815_004739_005DD8_3768.zip'),
38
        # for test_snap.test_slice_assembly
39
        's1_2': os.path.join(testdir, 'S1A_IW_GRDH_1SDV_20150222T170725_20150222T170750_004739_005DD8_CEAB.zip'),
40
        # for testing database duplicate handling
41
        's1_3': os.path.join(testdir, 'S1A_IW_GRDH_1SDV_20150203T043109_20150203T043134_004454_00574F_6D00.zip'),
42
        # for testing database duplicate handling
43
        's1_4': os.path.join(testdir, 'S1A_IW_GRDH_1SDV_20150203T043109_20150203T043134_004454_00574F_FEC3.zip'),
44
        # used in test_osv
45
        's1_orbit': os.path.join(testdir, 'S1A_IW_GRDH_1SDV_20210119T031653_20210119T031718_036201_043ED0_8255.zip'),
46
        'tif': os.path.join(testdir, 'S1A__IW___A_20150309T173017_VV_grd_mli_geo_norm_db.tif'),
47
        'archive_old_csv': os.path.join(testdir, 'archive_outdated.csv'),
48
        'archive_old_bbox': os.path.join(testdir, 'archive_outdated_bbox.db'),
49
        'dempar': os.path.join(testdir, 'dem.par'),
50
        'mlipar': os.path.join(testdir, 'mli.par')
51
    }
52
    return out
1✔
53

54

55
@pytest.fixture
1✔
56
def auxdata_dem_cases():
1✔
57
    cases = [
1✔
58
        ('AW3D30', ['N050E010/N051E011.tar.gz']),
59
        ('SRTM 1Sec HGT', ['https://step.esa.int/auxdata/dem/SRTMGL1/N51E011.SRTMGL1.hgt.zip']),
60
        ('SRTM 3Sec', ['https://step.esa.int/auxdata/dem/SRTM90/tiff/srtm_39_02.zip']),
61
        ('Copernicus 30m Global DEM', ['https://copernicus-dem-30m.s3.eu-central-1.amazonaws.com/'
62
                                       'Copernicus_DSM_COG_10_N51_00_E011_00_DEM/'
63
                                       'Copernicus_DSM_COG_10_N51_00_E011_00_DEM.tif'])
64
        # ('TDX90m', ['DEM/N51/E010/TDM1_DEM__30_N51E011.zip'])
65
    ]
66
    return cases
1✔
67

68

69
@pytest.fixture(scope='session', autouse=True)
1✔
70
def tmp_home(tmp_path_factory):
1✔
71
    home = tmp_path_factory.mktemp('home')
1✔
72
    snap = home / '.snap'
1✔
73
    
74
    if platform.system() == 'Windows':
1✔
NEW
75
        roaming_snap = Path(os.environ['APPDATA']) / 'SNAP'
×
NEW
76
        var_home = 'USERPROFILE'
×
NEW
77
        roaming = home / 'AppData' / 'Roaming'
×
NEW
78
        local = home / 'AppData' / 'Local'
×
NEW
79
        roaming.mkdir(parents=True, exist_ok=True)
×
NEW
80
        if roaming_snap.exists():
×
NEW
81
            shutil.copytree(roaming_snap, roaming / 'SNAP')
×
NEW
82
        local.mkdir(parents=True, exist_ok=True)
×
NEW
83
        os.environ['APPDATA'] = str(roaming)
×
NEW
84
        os.environ['LOCALAPPDATA'] = str(local)
×
NEW
85
        os.environ['HOME'] = str(home)
×
86
    else:
87
        var_home = 'HOME'
1✔
88
    os.environ[var_home] = str(home)
1✔
89
    
90
    assert os.path.expanduser('~') == str(home)
1✔
91
    
92
    snap_config = ExamineSnap()
1✔
93
    snap_config.userpath = str(snap)
1✔
94
    snap_config.auxdatapath = str(snap / 'auxdata')
1✔
95
    
96
    return home
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc