Skip to content

Commit

Permalink
Don't change line endings on test data
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Jun 21, 2021
1 parent e7e19db commit 4361be8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Do not change line endings on test data, it will change the MD5
/tests/data/ binary
7 changes: 3 additions & 4 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Get pip cache directory
id: pip-cache
run: |
python -m pip install --upgrade pip
echo "::set-output name=dir::$(pip cache dir)"
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
Expand All @@ -52,7 +50,8 @@ jobs:
if: ${{ runner.os == 'Windows' }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cython numpy # needed for pycocotools
pip install -r requirements.txt
- name: Run pytest checks
run: pytest -s --cov=. --cov-report=term-missing
run: pytest --cov=. --cov-report=term-missing
2 changes: 1 addition & 1 deletion tests/datasets/test_sen12ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def dataset(self, monkeypatch: Generator[MonkeyPatch, None, None]) -> SEN12MS:
]

monkeypatch.setattr(SEN12MS, "md5s", md5s) # type: ignore[attr-defined]
root = os.path.join(os.getcwd(), "tests", "data")
root = os.path.join("tests", "data")
split = "train"
transforms = Identity()
return SEN12MS(root, split, transforms, checksum=True)
Expand Down
14 changes: 1 addition & 13 deletions torchgeo/datasets/sen12ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import rasterio
import torch
from torch import Tensor
from torchvision.datasets.utils import calculate_md5, check_integrity
from torchvision.datasets.utils import check_integrity

from .geo import GeoDataset

Expand Down Expand Up @@ -189,18 +189,6 @@ def _check_integrity(self) -> bool:
"""
for filename, md5 in zip(self.filenames, self.md5s):
filepath = os.path.join(self.root, self.base_folder, filename)
exists = os.path.exists(filepath)
actual_md5 = calculate_md5(filepath) if exists else None
print(
"""
Filepath: {0}
exists: {1}
expected md5: {2}
actual md5: {3}
""".format(
filepath, exists, md5, actual_md5
)
)
if not check_integrity(filepath, md5 if self.checksum else None):
return False
return True

0 comments on commit 4361be8

Please sign in to comment.