Skip to content

Commit

Permalink
Add docker to test requirements. (#613)
Browse files Browse the repository at this point in the history
* Add docker to test requirements.

* Add docker to test requirements again??

* Docker in conda env?

* Conda calls it docker-py?

* Fix stac transform tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* xfail broken lib-cloud tests.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* xfail broken lib-cloud tests.

* xfail broken lib-cloud tests.

* Revert to old relative url handling.

* Roll back version number

* Catch different bucket case.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Satisfy pylint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Satisfy pylint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Satisfy pylint

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
SpacemanPaul and pre-commit-ci[bot] authored Jul 23, 2024
1 parent af7dbb2 commit f812309
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
12 changes: 6 additions & 6 deletions apps/dc_tools/odc/apps/dc_tools/_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,16 @@ def _find_self_href(item: Document) -> str:
def _get_relative_path(asset_href, self_link):
if self_link is None:
return asset_href
elif urlparse(self_link).netloc != urlparse(asset_href).netloc:
# files are not stored in same domain (e.g. diferent buckets)
self_parts = urlparse(self_link)
href_parts = urlparse(asset_href)

if self_parts.netloc.split(".")[0] != href_parts.netloc.split(".")[0]:
# files are not stored with same hostname (e.g. different buckets)
# therefore use the absolute path
return asset_href

self_path = urlparse(self_link).path
href_path = urlparse(asset_href).path

try:
return str(Path(href_path).relative_to(Path(self_path).parent))
return str(Path(href_parts.path).relative_to(Path(self_parts.path).parent))
except ValueError:
# if it's not relative, keep as an absolute link
return asset_href
Expand Down
2 changes: 1 addition & 1 deletion apps/dc_tools/odc/apps/dc_tools/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.18"
__version__ = "0.2.17"
2 changes: 2 additions & 0 deletions apps/dc_tools/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ python_requires = >= 3.9
tests_require =
pytest
deepdiff
docker

install_requires =
click
Expand All @@ -41,6 +42,7 @@ install_requires =
tests =
pytest
deepdiff
docker

AZURE = odc-cloud[AZURE]
THREDDS = odc-cloud[THREDDS]
Expand Down
3 changes: 2 additions & 1 deletion apps/dc_tools/tests/test_stac_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def test_landsat_stac_transform(landsat_stac, landsat_odc):

def test_sentinel_stac_transform(sentinel_stac_old, sentinel_odc):
transformed_stac_doc = stac_transform(sentinel_stac_old)
assert len(get_doc_changes(transformed_stac_doc, sentinel_odc)) == 1
doc_changes = get_doc_changes(transformed_stac_doc, sentinel_odc)
assert len(doc_changes) == 1


def test_usgs_landsat_stac_transform(usgs_landsat_stac):
Expand Down
3 changes: 3 additions & 0 deletions libs/cloud/tests/test_azure.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Test thredds downloader code
"""

import pytest
from odc.azure import download_yamls, find_blobs


@pytest.mark.xfail(reason="Libcloud azure tests are broken")
def test_find_blobs():
"""Find blobs in a sample Azure account, this will fail if the blob store changes or is removed"""

Expand All @@ -21,6 +23,7 @@ def test_find_blobs():
assert len(blob_names) == 1


@pytest.mark.xfail(reason="Libcloud azure tests are broken")
def test_download_yamls():
"""Test pass/fail arms of YAML download from Azure blobstore"""

Expand Down
14 changes: 10 additions & 4 deletions libs/io/odc/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
""" Various file io helpers
"""

from .tar import tar_doc_stream
from .text import parse_mtl, parse_yaml, read_stdin_lines, slurp, slurp_lines
from .timer import RateEstimator
from .tar import tar_doc_stream # pylint: disable=W0406
from .text import (
parse_mtl, # pylint: disable=W0406
parse_yaml, # pylint: disable=W0406
read_stdin_lines, # pylint: disable=W0406
slurp, # pylint: disable=W0406
slurp_lines, # pylint: disable=W0406
)
from .timer import RateEstimator # pylint: disable=W0406

from ._version import __version__
from ._version import __version__ # pylint: disable=W0406

__all__ = (
"parse_yaml",
Expand Down
1 change: 1 addition & 0 deletions tests/test-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies:
- lxml # needed for thredds-crawler
- urlpath
- datadog
- docker-py
- eodatasets3
- importlib_resources>=6.0

Expand Down

0 comments on commit f812309

Please sign in to comment.