pytest-jsonschema-snapshot 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,5 +8,5 @@ pytest-typed-schema-shot
8
8
 
9
9
  from .core import SchemaShot
10
10
 
11
- __version__ = "0.2.1"
11
+ __version__ = "0.2.2"
12
12
  __all__ = ["SchemaShot"]
@@ -234,13 +234,14 @@ class SchemaShot:
234
234
  schema_updated = False
235
235
 
236
236
  if existing_schema != current_schema: # есть отличия
237
- differences = self.differ.compare(dict(existing_schema), current_schema).render()
238
-
239
237
  if (self.update_mode or self.reset_mode) and self.update_actions.get("update"):
240
- GLOBAL_STATS.add_updated(schema_path.name, differences)
241
-
242
238
  # обновляем файл
243
239
  if self.reset_mode and not self.update_mode:
240
+ differences = self.differ.compare(
241
+ dict(existing_schema), current_schema
242
+ ).render()
243
+ GLOBAL_STATS.add_updated(schema_path.name, differences)
244
+
244
245
  with open(schema_path, "w", encoding="utf-8") as f:
245
246
  json.dump(current_schema, f, indent=2, ensure_ascii=False)
246
247
  self.logger.warning(f"Schema `{name}` updated (reset).\n\n{differences}")
@@ -252,6 +253,11 @@ class SchemaShot:
252
253
  builder.add_schema(current_schema)
253
254
  merged_schema = builder.to_schema()
254
255
 
256
+ differences = self.differ.compare(
257
+ dict(existing_schema), merged_schema
258
+ ).render()
259
+ GLOBAL_STATS.add_updated(schema_path.name, differences)
260
+
255
261
  with open(schema_path, "w", encoding="utf-8") as f:
256
262
  json.dump(merged_schema, f, indent=2, ensure_ascii=False)
257
263
 
@@ -262,6 +268,9 @@ class SchemaShot:
262
268
  )
263
269
  schema_updated = True
264
270
  elif data is not None:
271
+ differences = self.differ.compare(
272
+ dict(existing_schema), current_schema
273
+ ).render()
265
274
  GLOBAL_STATS.add_uncommitted(schema_path.name, differences)
266
275
 
267
276
  # только валидируем по старой схеме
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-jsonschema-snapshot
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Pytest plugin for automatic JSON Schema generation and validation from examples
5
5
  Project-URL: Homepage, https://miskler.github.io/pytest-jsonschema-snapshot/basic/quick_start.html
6
6
  Project-URL: Repository, https://github.com/Miskler/pytest-jsonschema-snapshot
@@ -1,5 +1,5 @@
1
- pytest_jsonschema_snapshot/__init__.py,sha256=A3cUmyPftYWT68KRDu3V6WNGuIKdkqCtxYQS3eyPwbk,385
2
- pytest_jsonschema_snapshot/core.py,sha256=951wNZ6BiVToaK8l-l5hgj8WPePBTSK5bDZqFOAZztg,11399
1
+ pytest_jsonschema_snapshot/__init__.py,sha256=5TgaOzEtd_zql5fMk737SJ342QjH3l3atIBWuko_20g,385
2
+ pytest_jsonschema_snapshot/core.py,sha256=vkS_aD8L2iqCQF9pGMlE63EuUFRC9sZSsrLQ2waLuEI,11852
3
3
  pytest_jsonschema_snapshot/plugin.py,sha256=nvAfxtLSX_B5FzaWu7DfsiWRxFjxDvnQNNOhkRrRnbw,8677
4
4
  pytest_jsonschema_snapshot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  pytest_jsonschema_snapshot/stats.py,sha256=XGGzHY0ytMFOkFpnqNAK1DpV9iI0_fZPWrVvHFNFL3g,7943
@@ -8,8 +8,8 @@ pytest_jsonschema_snapshot/tools/name_maker.py,sha256=tqss8NCGSo2aQX_-RkCJzy3NJx
8
8
  pytest_jsonschema_snapshot/tools/genson_addon/__init__.py,sha256=nANkqHTaWTZPwBDztsnQvObHUZLSeHenJS--oWfep8c,92
9
9
  pytest_jsonschema_snapshot/tools/genson_addon/format_detector.py,sha256=Wc5pB_xstyr4OtjwJ2qqmV62xET63cN7Nb0gxkrYyW0,1636
10
10
  pytest_jsonschema_snapshot/tools/genson_addon/to_schema_converter.py,sha256=UdQIkZhMrTJNHwI1B1dv3aEwx41B1B_lLyr4KWiUpNY,4168
11
- pytest_jsonschema_snapshot-0.2.1.dist-info/METADATA,sha256=sKa-GvRU2__0rk-bOFpPhaIT7_gnZvkJX15AWRvkkl4,7657
12
- pytest_jsonschema_snapshot-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- pytest_jsonschema_snapshot-0.2.1.dist-info/entry_points.txt,sha256=eJ1x4TMmhcc8YtM7IoCsUJO4-rLeTrGy8tPgkrojjKs,58
14
- pytest_jsonschema_snapshot-0.2.1.dist-info/licenses/LICENSE,sha256=1HRFdSzlJ4BtHv6U7tZun3iCArjbCnm5NUowE9hZpNs,1071
15
- pytest_jsonschema_snapshot-0.2.1.dist-info/RECORD,,
11
+ pytest_jsonschema_snapshot-0.2.2.dist-info/METADATA,sha256=81-o1vJwGBWxE_neIz7kT6LS-Dw8PRxZSWURWzUHW9E,7657
12
+ pytest_jsonschema_snapshot-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ pytest_jsonschema_snapshot-0.2.2.dist-info/entry_points.txt,sha256=eJ1x4TMmhcc8YtM7IoCsUJO4-rLeTrGy8tPgkrojjKs,58
14
+ pytest_jsonschema_snapshot-0.2.2.dist-info/licenses/LICENSE,sha256=1HRFdSzlJ4BtHv6U7tZun3iCArjbCnm5NUowE9hZpNs,1071
15
+ pytest_jsonschema_snapshot-0.2.2.dist-info/RECORD,,