json-database 1.0.4a2__tar.gz → 1.0.5a1__tar.gz

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.
Files changed (27) hide show
  1. {json_database-1.0.4a2 → json_database-1.0.5a1}/PKG-INFO +1 -1
  2. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database/__init__.py +1 -1
  3. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database/version.py +2 -2
  4. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database.egg-info/PKG-INFO +1 -1
  5. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_storage.py +14 -0
  6. {json_database-1.0.4a2 → json_database-1.0.5a1}/LICENSE +0 -0
  7. {json_database-1.0.4a2 → json_database-1.0.5a1}/README.md +0 -0
  8. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database/crypto.py +0 -0
  9. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database/exceptions.py +0 -0
  10. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database/search.py +0 -0
  11. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database/utils.py +0 -0
  12. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database/xdg_utils.py +0 -0
  13. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database.egg-info/SOURCES.txt +0 -0
  14. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database.egg-info/dependency_links.txt +0 -0
  15. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database.egg-info/requires.txt +0 -0
  16. {json_database-1.0.4a2 → json_database-1.0.5a1}/json_database.egg-info/top_level.txt +0 -0
  17. {json_database-1.0.4a2 → json_database-1.0.5a1}/pyproject.toml +0 -0
  18. {json_database-1.0.4a2 → json_database-1.0.5a1}/setup.cfg +0 -0
  19. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_crypto.py +0 -0
  20. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_database.py +0 -0
  21. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_e2e_user_database.py +0 -0
  22. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_encrypted_storage.py +0 -0
  23. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_exceptions.py +0 -0
  24. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_query.py +0 -0
  25. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_search.py +0 -0
  26. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_xdg.py +0 -0
  27. {json_database-1.0.4a2 → json_database-1.0.5a1}/test/test_xdg_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_database
3
- Version: 1.0.4a2
3
+ Version: 1.0.5a1
4
4
  Summary: searchable json database with persistence
5
5
  Author-email: jarbasAI <jarbasai@mailfence.com>
6
6
  License: MIT
@@ -134,7 +134,7 @@ class JsonStorage(dict):
134
134
  return
135
135
  path = expanduser(path)
136
136
  if dirname(path) and not isdir(dirname(path)):
137
- makedirs(dirname(path))
137
+ makedirs(dirname(path), exist_ok=True)
138
138
  self._atomic_write(path, json.dumps(self, indent=4,
139
139
  ensure_ascii=False))
140
140
 
@@ -1,8 +1,8 @@
1
1
  # START_VERSION_BLOCK
2
2
  VERSION_MAJOR = 1
3
3
  VERSION_MINOR = 0
4
- VERSION_BUILD = 4
5
- VERSION_ALPHA = 2
4
+ VERSION_BUILD = 5
5
+ VERSION_ALPHA = 1
6
6
  # END_VERSION_BLOCK
7
7
 
8
8
  __version__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_BUILD}" + (f"a{VERSION_ALPHA}" if VERSION_ALPHA else "")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_database
3
- Version: 1.0.4a2
3
+ Version: 1.0.5a1
4
4
  Summary: searchable json database with persistence
5
5
  Author-email: jarbasAI <jarbasai@mailfence.com>
6
6
  License: MIT
@@ -508,3 +508,17 @@ class TestJsonStorageAtomicWrite:
508
508
 
509
509
  stat = os.stat(db_file)
510
510
  assert (stat.st_uid, stat.st_gid) == (owner.pw_uid, owner.pw_gid)
511
+
512
+
513
+ class TestStoreDirectoryRace:
514
+ """Another process may create the directory after the isdir check."""
515
+
516
+ def test_store_when_directory_appears_after_check(self, tmp_path, monkeypatch):
517
+ target = tmp_path / "apps" / "settings.json"
518
+ target.parent.mkdir()
519
+ monkeypatch.setattr("json_database.isdir", lambda _: False)
520
+ storage = JsonStorage(str(target), disable_lock=True)
521
+ storage["key"] = "value"
522
+ storage.store()
523
+ with open(target) as f:
524
+ assert json.load(f) == {"key": "value"}
File without changes