Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: windows support #9

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.8, 3.12]
os: [ubuntu-latest]
python-version: [3.8, "3.12"]
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout the repo
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion eodag_cube/api/product/drivers/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_data_address(self, eo_product, band):
try:
# return the first file readable by rasterio
rasterio.drivers.driver_from_extension(filename)
return str(filename)
return str(filename.resolve())
except ValueError:
pass
raise AddressNotFound
Expand Down
2 changes: 1 addition & 1 deletion eodag_cube/api/product/drivers/sentinel2_l1c.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_data_address(self, eo_product, band):
lambda f: band_file_pattern.match(f),
subdataset.files,
):
return filename
return os.path.normpath(filename)
raise AddressNotFound
if product_location_scheme == "s3":
access_key, access_secret = eo_product.downloader_auth.authenticate()
Expand Down
2 changes: 1 addition & 1 deletion tests/units/test_eoproduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_eoproduct_driver_ok(self):
def test_get_data_local_product_ok(self):
"""A call to get_data on a product present in the local filesystem must succeed""" # noqa
self.eoproduct_props.update(
{"downloadLink": "file://{}".format(self.local_product_abspath)}
{"downloadLink": "file:///{}".format(self.local_product_abspath.strip("/"))}
)
product = EOProduct(
self.provider, self.eoproduct_props, productType=self.product_type
Expand Down
4 changes: 3 additions & 1 deletion tests/units/test_eoproduct_driver_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ def test_driver_get_http_remote_dataset_address_fail(self):
def _filesystem_product(self):
original = self.product.location
try:
self.product.location = "file://{}".format(self.product.properties["title"])
self.product.location = "file:///{}".format(
self.product.properties["title"].strip("/")
)
yield self.product
finally:
self.product.location = original
4 changes: 3 additions & 1 deletion tests/units/test_eoproduct_driver_sentinel2_l1c.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def test_driver_get_http_remote_dataset_address_fail(self):
def _filesystem_product(self):
original = self.product.location
try:
self.product.location = "file://{}".format(self.product.properties["title"])
self.product.location = "file:///{}".format(
self.product.properties["title"].strip("/")
)
yield self.product
finally:
self.product.location = original
Expand Down
30 changes: 17 additions & 13 deletions tests/units/test_eoproduct_driver_stac_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,40 @@ def setUp(self):
"products",
"S2A_MSIL1C_20180101T105441_N0206_R051_T31TDH_20180101T124911.SAFE",
)
product_img_data_path = os.path.join(
TEST_RESOURCES_PATH,
"products",
"S2A_MSIL1C_20180101T105441_N0206_R051_T31TDH_20180101T124911.SAFE",
"GRANULE",
"L1C_T31TDH_A013204_20180101T105435",
"IMG_DATA",
)
self.product.assets = {
"T31TDH_20180101T124911_B01.jp2": {
"title": "Band 1",
"type": "image/jp2",
"roles": ["data"],
"href": os.path.join(
TEST_RESOURCES_PATH,
"products",
"S2A_MSIL1C_20180101T105441_N0206_R051_T31TDH_20180101T124911.SAFE/"
+ "GRANULE/L1C_T31TDH_A013204_20180101T105435/IMG_DATA/T31TDH_20180101T105441_B01.jp2",
product_img_data_path,
"T31TDH_20180101T105441_B01.jp2",
),
},
"T31TDH_20180101T124911_B03.jp2": {
"title": "Band 3",
"type": "image/jp2",
"roles": ["data"],
"href": os.path.join(
TEST_RESOURCES_PATH,
"products",
"S2A_MSIL1C_20180101T105441_N0206_R051_T31TDH_20180101T124911.SAFE/"
+ "GRANULE/L1C_T31TDH_A013204_20180101T105435/IMG_DATA/T31TDH_20180101T105441_B03.jp2",
product_img_data_path,
"T31TDH_20180101T105441_B03.jp2",
),
},
"T31TDH_20180101T124911_B01.json": {
"title": "Band 1 metadata",
"type": "image/jp2",
"roles": ["metadata"],
"href": os.path.join(
TEST_RESOURCES_PATH,
"products",
"S2A_MSIL1C_20180101T105441_N0206_R051_T31TDH_20180101T124911.SAFE/"
+ "GRANULE/L1C_T31TDH_A013204_20180101T105435/IMG_DATA/T31TDH_20180101T105441_B01.json",
product_img_data_path,
"T31TDH_20180101T105441_B01.json",
),
},
}
Expand Down Expand Up @@ -100,7 +102,9 @@ def test_driver_get_local_dataset_address_ok(self):
def _filesystem_product(self):
original = self.product.location
try:
self.product.location = "file://{}".format(self.product.properties["title"])
self.product.location = "file:///{}".format(
self.product.properties["title"].strip("/")
)
yield self.product
finally:
self.product.location = original
Loading