Skip to content

Commit aeafd98

Browse files
authored
fix(tests): clear the validator before each test (#1242)
1 parent e5fa32c commit aeafd98

File tree

289 files changed

+92320
-988
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+92320
-988
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Fixed
1010

1111
- Typing of `href` arguments ([#1234](https://github.com/stac-utils/pystac/pull/1234))
12+
- Interactions between **pytest-recording** and the validator schema cache ([#1242](https://github.com/stac-utils/pystac/pull/1242))
1213

1314
## [v1.8.4] - 2023-09-22
1415

pystac/validation/local_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def _validate_from_local(
111111

112112
def _validator(self, stac_type: str, version: str) -> Draft7Validator:
113113
schema = _read_schema(f"stac-spec/v{version}/{stac_type}.json")
114-
return Draft7Validator(schema, registry=self.registry)
114+
return Draft7Validator(schema, registry=self.registry())
115115

116116
def catalog_validator(self, version: str = VERSION) -> Draft7Validator:
117117
return self._validator("catalog", version)

tests/cassettes/test_catalog/TestCatalog.test_read_remote.yaml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ interactions:
3737
Cross-Origin-Resource-Policy:
3838
- cross-origin
3939
Date:
40-
- Fri, 22 Sep 2023 19:13:47 GMT
40+
- Wed, 27 Sep 2023 21:19:53 GMT
4141
ETag:
4242
- '"e74ebcbc46d43c5b693ecb995381fbeba03583627e6d65b21ed7678a10d94729"'
4343
Expires:
44-
- Fri, 22 Sep 2023 19:18:47 GMT
44+
- Wed, 27 Sep 2023 21:24:53 GMT
4545
Source-Age:
4646
- '0'
4747
Strict-Transport-Security:
@@ -51,21 +51,21 @@ interactions:
5151
Via:
5252
- 1.1 varnish
5353
X-Cache:
54-
- MISS
54+
- HIT
5555
X-Cache-Hits:
56-
- '0'
56+
- '1'
5757
X-Content-Type-Options:
5858
- nosniff
5959
X-Fastly-Request-ID:
60-
- 02289045ec4473cb0c90eb413af6020437e0a8e0
60+
- c8250cab95667b61e3288bcb3ed456aa681f31b2
6161
X-Frame-Options:
6262
- deny
6363
X-GitHub-Request-Id:
64-
- A942:394D:1B35C5:2001FB:650DE769
64+
- 0FCE:5675:3E60:4E0D:65149A87
6565
X-Served-By:
66-
- cache-den8281-DEN
66+
- cache-lga21951-LGA
6767
X-Timer:
68-
- S1695410027.011637,VS0,VE150
68+
- S1695849594.681744,VS0,VE80
6969
X-XSS-Protection:
7070
- 1; mode=block
7171
status:
@@ -127,11 +127,11 @@ interactions:
127127
Cross-Origin-Resource-Policy:
128128
- cross-origin
129129
Date:
130-
- Fri, 22 Sep 2023 19:13:47 GMT
130+
- Wed, 27 Sep 2023 21:19:53 GMT
131131
ETag:
132132
- '"ddd340bc27c120dd2e43868bcde0510a326a6223dac1b0c47c05100e20d1397e"'
133133
Expires:
134-
- Fri, 22 Sep 2023 19:18:47 GMT
134+
- Wed, 27 Sep 2023 21:24:53 GMT
135135
Source-Age:
136136
- '0'
137137
Strict-Transport-Security:
@@ -141,21 +141,21 @@ interactions:
141141
Via:
142142
- 1.1 varnish
143143
X-Cache:
144-
- MISS
144+
- HIT
145145
X-Cache-Hits:
146-
- '0'
146+
- '1'
147147
X-Content-Type-Options:
148148
- nosniff
149149
X-Fastly-Request-ID:
150-
- 1faabc2f221d7528ed2cb4ce476bb4743267dec7
150+
- ee433958a36f405851103062a9bf386e5db2217e
151151
X-Frame-Options:
152152
- deny
153153
X-GitHub-Request-Id:
154-
- 390A:531D:17C928:1C9465:650DE76A
154+
- A926:6AE7:2E60:3C38:65149A88
155155
X-Served-By:
156-
- cache-den8274-DEN
156+
- cache-lga21965-LGA
157157
X-Timer:
158-
- S1695410027.284138,VS0,VE129
158+
- S1695849594.867877,VS0,VE81
159159
X-XSS-Protection:
160160
- 1; mode=block
161161
status:
@@ -227,11 +227,11 @@ interactions:
227227
Cross-Origin-Resource-Policy:
228228
- cross-origin
229229
Date:
230-
- Fri, 22 Sep 2023 19:13:47 GMT
230+
- Wed, 27 Sep 2023 21:19:54 GMT
231231
ETag:
232232
- '"80ec96bc0acf2e604a03f109bd730426aa82e442d44946231cbe82a531b944f7"'
233233
Expires:
234-
- Fri, 22 Sep 2023 19:18:47 GMT
234+
- Wed, 27 Sep 2023 21:24:54 GMT
235235
Source-Age:
236236
- '0'
237237
Strict-Transport-Security:
@@ -241,21 +241,21 @@ interactions:
241241
Via:
242242
- 1.1 varnish
243243
X-Cache:
244-
- MISS
244+
- HIT
245245
X-Cache-Hits:
246-
- '0'
246+
- '1'
247247
X-Content-Type-Options:
248248
- nosniff
249249
X-Fastly-Request-ID:
250-
- af8a2e5e50cf4a6b7933ef2cd7c2c27078a65d39
250+
- 2adea1b418fa9194e021a9cddf8940135145355d
251251
X-Frame-Options:
252252
- deny
253253
X-GitHub-Request-Id:
254-
- 7364:1817:169CBE:1B6929:650DE76A
254+
- 4992:28E3:3397:41F3:65149A87
255255
X-Served-By:
256-
- cache-den8236-DEN
256+
- cache-lga21955-LGA
257257
X-Timer:
258-
- S1695410028.515211,VS0,VE166
258+
- S1695849594.063816,VS0,VE72
259259
X-XSS-Protection:
260260
- 1; mode=block
261261
status:
@@ -327,11 +327,11 @@ interactions:
327327
Cross-Origin-Resource-Policy:
328328
- cross-origin
329329
Date:
330-
- Fri, 22 Sep 2023 19:13:47 GMT
330+
- Wed, 27 Sep 2023 21:19:54 GMT
331331
ETag:
332332
- '"726870312c74ead0b10c3125045c301e8600929684c49447d64c2db72dc779fc"'
333333
Expires:
334-
- Fri, 22 Sep 2023 19:18:47 GMT
334+
- Wed, 27 Sep 2023 21:24:54 GMT
335335
Source-Age:
336336
- '0'
337337
Strict-Transport-Security:
@@ -341,21 +341,21 @@ interactions:
341341
Via:
342342
- 1.1 varnish
343343
X-Cache:
344-
- MISS
344+
- HIT
345345
X-Cache-Hits:
346-
- '0'
346+
- '1'
347347
X-Content-Type-Options:
348348
- nosniff
349349
X-Fastly-Request-ID:
350-
- 9e07dc7de7a765128e6a8ae9fc028d69a4502bdb
350+
- a17a4b697a894e9a49687527cea60f190d84dabe
351351
X-Frame-Options:
352352
- deny
353353
X-GitHub-Request-Id:
354-
- BB3C:61A6:15AFE9:1A7D50:650DE76B
354+
- 5ACE:2795:4719:5769:65149A87
355355
X-Served-By:
356-
- cache-den8223-DEN
356+
- cache-lga21935-LGA
357357
X-Timer:
358-
- S1695410028.779866,VS0,VE131
358+
- S1695849594.236812,VS0,VE101
359359
X-XSS-Protection:
360360
- 1; mode=block
361361
status:

tests/cassettes/test_catalog/TestCatalog.test_validate_all[cat0].yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ interactions:
110110
Access-Control-Allow-Origin:
111111
- '*'
112112
Age:
113-
- '0'
113+
- '497'
114114
Cache-Control:
115115
- max-age=600
116116
Connection:
@@ -120,7 +120,7 @@ interactions:
120120
Content-Type:
121121
- application/json; charset=utf-8
122122
Date:
123-
- Fri, 22 Sep 2023 19:13:49 GMT
123+
- Wed, 27 Sep 2023 21:19:57 GMT
124124
ETag:
125125
- '"61eb1dc9-1abf"'
126126
Last-Modified:
@@ -134,19 +134,19 @@ interactions:
134134
Via:
135135
- 1.1 varnish
136136
X-Cache:
137-
- MISS
137+
- HIT
138138
X-Cache-Hits:
139-
- '0'
139+
- '1'
140140
X-Fastly-Request-ID:
141-
- aefd7fd863a66263bbc2b318eaf85dfe5b985226
141+
- 0143e3b78ec477aa5b33fac747cd6eaf4005d0d3
142142
X-GitHub-Request-Id:
143-
- 5F5C:6545:C45AE5:11B6DB0:650DE76B
143+
- 821C:0FF5:2D086F:420327:6514696C
144144
X-Served-By:
145-
- cache-den8275-DEN
145+
- cache-lga21962-LGA
146146
X-Timer:
147-
- S1695410030.515408,VS0,VE62
147+
- S1695849597.293127,VS0,VE1
148148
expires:
149-
- Fri, 22 Sep 2023 19:23:49 GMT
149+
- Wed, 27 Sep 2023 17:52:04 GMT
150150
permissions-policy:
151151
- interest-cohort=()
152152
x-proxy-cache:
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Connection:
6+
- close
7+
Host:
8+
- stac-extensions.github.io
9+
User-Agent:
10+
- Python-urllib/3.11
11+
method: GET
12+
uri: https://stac-extensions.github.io/label/v1.0.1/schema.json
13+
response:
14+
body:
15+
string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\":
16+
\"https://stac-extensions.github.io/label/v1.0.1/schema.json#\",\n \"title\":
17+
\"Label Extension\",\n \"description\": \"STAC Label Extension for STAC Items
18+
and STAC Collections.\",\n \"oneOf\": [\n {\n \"$comment\": \"This
19+
is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"type\":
20+
\"object\",\n \"required\": [\n \"type\",\n \"properties\",\n
21+
\ \"links\",\n \"assets\"\n ],\n \"properties\":
22+
{\n \"type\": {\n \"const\": \"Feature\"\n },\n
23+
\ \"properties\": {\n \"allOf\": [\n {\n
24+
\ \"$comment\": \"Require fields here for item properties.\",\n
25+
\ \"required\": [\n \"label:properties\",\n
26+
\ \"label:description\",\n \"label:type\"\n
27+
\ ]\n },\n {\n \"$ref\":
28+
\"#/definitions/fields\"\n }\n ]\n },\n
29+
\ \"links\": {\n \"type\": \"array\",\n \"items\":
30+
{\n \"$ref\": \"#/definitions/link_fields\"\n }\n
31+
\ },\n \"assets\": {\n \"type\": \"object\",\n
32+
\ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n
33+
\ }\n }\n }\n },\n {\n \"$ref\":
34+
\"#/definitions/stac_extensions\"\n }\n ]\n },\n {\n \"$comment\":
35+
\"This is the schema for STAC Collections.\",\n \"allOf\": [\n {\n
36+
\ \"type\": \"object\",\n \"required\": [\n \"type\"\n
37+
\ ],\n \"properties\": {\n \"type\": {\n \"const\":
38+
\"Collection\"\n },\n \"assets\": {\n \"type\":
39+
\"object\",\n \"additionalProperties\": {\n \"$ref\":
40+
\"#/definitions/fields\"\n }\n },\n \"item_assets\":
41+
{\n \"type\": \"object\",\n \"additionalProperties\":
42+
{\n \"$ref\": \"#/definitions/fields\"\n }\n }\n
43+
\ }\n },\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n
44+
\ }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\":
45+
{\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n
46+
\ ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\":
47+
\"array\",\n \"contains\": {\n \"const\": \"https://stac-extensions.github.io/label/v1.0.1/schema.json\"\n
48+
\ }\n }\n }\n },\n \"link_fields\": {\n \"type\":
49+
\"object\",\n \"properties\": {\n \"label:assets\": {\n \"type\":
50+
\"array\",\n \"items\": {\n \"type\": \"string\"\n }\n
51+
\ }\n },\n \"patternProperties\": {\n \"^(?!label:)\":
52+
{}\n },\n \"additionalProperties\": false\n },\n \"fields\":
53+
{\n \"type\": \"object\",\n \"properties\": {\n \"label:properties\":
54+
{\n \"title\": \"Property\",\n \"oneOf\": [\n {\n
55+
\ \"type\": \"array\",\n \"minItems\": 1,\n \"items\":
56+
{\n \"type\": \"string\"\n }\n },\n
57+
\ {\n \"type\": \"null\"\n }\n ]\n
58+
\ },\n \"label:classes\": {\n \"title\": \"Classes\",\n
59+
\ \"type\": \"array\",\n \"items\": {\n \"type\":
60+
\"object\",\n \"required\": [\n \"name\",\n \"classes\"\n
61+
\ ],\n \"properties\": {\n \"name\": {\n
62+
\ \"title\": \"Name\"\n },\n \"classes\":
63+
{\n \"title\": \"Classes\",\n \"oneOf\": [\n
64+
\ {\n \"type\": \"array\",\n \"items\":
65+
{\n \"type\": \"string\"\n }\n },\n
66+
\ {\n \"type\": \"array\",\n \"items\":
67+
{\n \"type\": \"number\"\n }\n }\n
68+
\ ]\n }\n }\n }\n },\n
69+
\ \"label:description\": {\n \"title\": \"Description\",\n
70+
\ \"type\": \"string\",\n \"minLength\": 1\n },\n
71+
\ \"label:type\": {\n \"title\": \"Type\",\n \"type\":
72+
\"string\",\n \"enum\": [\n \"raster\",\n \"vector\"\n
73+
\ ]\n },\n \"label:tasks\": {\n \"title\":
74+
\"Task\",\n \"type\": \"array\",\n \"items\": {\n \"type\":
75+
\"string\"\n }\n },\n \"label:methods\": {\n \"title\":
76+
\"Method\",\n \"type\": \"array\",\n \"items\": {\n \"type\":
77+
\"string\"\n }\n },\n \"label:overviews\": {\n \"title\":
78+
\"Overview\",\n \"type\": \"array\",\n \"items\": {\n \"type\":
79+
\"object\",\n \"properties\": {\n \"property_key\":
80+
{\n \"title\": \"Property Key\",\n \"type\":
81+
\"string\"\n },\n \"counts\": {\n \"title\":
82+
\"Counts\",\n \"type\": \"array\",\n \"items\":
83+
{\n \"type\": \"object\",\n \"properties\":
84+
{\n \"name\": {\n \"title\": \"Class
85+
Name\",\n \"type\": \"string\"\n },\n
86+
\ \"count\": {\n \"title\": \"Count\",\n
87+
\ \"type\": \"integer\"\n }\n }\n
88+
\ }\n },\n \"statistics\": {\n \"title\":
89+
\"Statistics\",\n \"type\": \"array\",\n \"items\":
90+
{\n \"type\": \"object\",\n \"properties\":
91+
{\n \"name\": {\n \"title\": \"Stat
92+
Name\",\n \"type\": \"string\"\n },\n
93+
\ \"value\": {\n \"title\": \"Value\",\n
94+
\ \"type\": \"number\"\n }\n }\n
95+
\ }\n }\n }\n }\n }\n
96+
\ },\n \"if\": {\n \"properties\": {\n \"label:type\":
97+
{\n \"const\": \"raster\"\n }\n }\n },\n \"then\":
98+
{\n \"properties\": {\n \"label:classes\": {\n \"items\":
99+
{\n \"properties\": {\n \"name\": {\n \"type\":
100+
\"null\"\n }\n }\n }\n }\n
101+
\ }\n },\n \"else\": {\n \"properties\": {\n \"label:classes\":
102+
{\n \"items\": {\n \"properties\": {\n \"name\":
103+
{\n \"type\": \"string\",\n \"minLength\":
104+
1\n }\n }\n }\n }\n }\n
105+
\ },\n \"patternProperties\": {\n \"^(?!label:)\": {}\n },\n
106+
\ \"additionalProperties\": false\n }\n }\n}"
107+
headers:
108+
Accept-Ranges:
109+
- bytes
110+
Access-Control-Allow-Origin:
111+
- '*'
112+
Age:
113+
- '497'
114+
Cache-Control:
115+
- max-age=600
116+
Connection:
117+
- close
118+
Content-Length:
119+
- '6847'
120+
Content-Type:
121+
- application/json; charset=utf-8
122+
Date:
123+
- Wed, 27 Sep 2023 21:19:57 GMT
124+
ETag:
125+
- '"61eb1dc9-1abf"'
126+
Last-Modified:
127+
- Fri, 21 Jan 2022 20:55:37 GMT
128+
Server:
129+
- GitHub.com
130+
Strict-Transport-Security:
131+
- max-age=31556952
132+
Vary:
133+
- Accept-Encoding
134+
Via:
135+
- 1.1 varnish
136+
X-Cache:
137+
- HIT
138+
X-Cache-Hits:
139+
- '1'
140+
X-Fastly-Request-ID:
141+
- 8e0c7f08fe1dee62273884e215cc2f9033ee7dd2
142+
X-GitHub-Request-Id:
143+
- 821C:0FF5:2D086F:420327:6514696C
144+
X-Served-By:
145+
- cache-lga21932-LGA
146+
X-Timer:
147+
- S1695849598.593243,VS0,VE1
148+
expires:
149+
- Wed, 27 Sep 2023 17:52:04 GMT
150+
permissions-policy:
151+
- interest-cohort=()
152+
x-proxy-cache:
153+
- MISS
154+
status:
155+
code: 200
156+
message: OK
157+
version: 1

0 commit comments

Comments
 (0)