Skip to content

Commit 9534c4c

Browse files
committed
Collection date times not matching with granules errors #299
1 parent 768ea39 commit 9534c4c

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

pyQuARC/code/schema_validator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from io import BytesIO
66
from jsonschema import Draft7Validator, draft7_format_checker, RefResolver
7+
#from jsonschema import Draft7Validator, FormatChecker, RefResolver
8+
format_checker = Draft7Validator.FORMAT_CHECKER
79
from lxml import etree
810
from urllib.request import pathname2url
911

pyQuARC/code/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ def get_date_time(dt_str):
7777
"""
7878
for fmt in DATE_FORMATS:
7979
try:
80+
#print(f"Trying format: {fmt}")
8081
date_time = datetime.strptime(dt_str, fmt)
81-
return date_time
82+
#return date_time
83+
return date_time.strftime("%Y-%m-%dT%H:%M:%SZ")
8284
except ValueError:
8385
continue
84-
return None
86+
return False, None
87+
#return None

pytest.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[pytest]
2+
filterwarnings =
3+
ignore:ssl\.PROTOCOL_TLS is deprecated:DeprecationWarning
4+
ignore:ssl\.match_hostname\(\) is deprecated:DeprecationWarning
5+
ignore:Accessing jsonschema\.draft7_format_checker is deprecated:DeprecationWarning

tests/test_downloader.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
from pyQuARC.code.downloader import Downloader
2+
#import warnings # new
3+
#import pytest # new
4+
#warnings.filterwarnings("ignore", category=DeprecationWarning) #new
5+
26

37

48
class TestDownloader:
@@ -9,11 +13,11 @@ class TestDownloader:
913
def setup_method(self):
1014
self.concept_ids = {
1115
"collection": {
12-
"real": "C1339230297-GES_DISC",
16+
"real": "C1620496172-CDDIS",
1317
"dummy": "C123456-LPDAAC_ECS",
1418
},
1519
"granule": {
16-
"real": "G1370895082-GES_DISC",
20+
"real": "G2128996127-CDDIS",
1721
"dummy": "G1000000002-CMR_PROV",
1822
},
1923
"invalid": "asdfasdf",
@@ -134,7 +138,7 @@ def test_download_real_collection_no_errors(self):
134138
downloader = Downloader(real_collection, "echo-c")
135139

136140
downloader.download()
137-
141+
print(downloader)
138142
# is the concept id valid and is the request going through?
139143
assert downloader.errors == []
140144

0 commit comments

Comments
 (0)