Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split core functionality and support orjson and msgspec #9

Merged
merged 27 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
60893a5
Refactor into core and json module, add orjson support
nhairs Apr 27, 2024
7f7ea2a
Format tests
nhairs Apr 27, 2024
e9aff5b
Allow tests to complete on all platforms
nhairs Apr 27, 2024
eaf56e2
Fix broken GHA spec
nhairs Apr 27, 2024
c36d6da
Don't support defaults kwargs (py310+ only)
nhairs Apr 27, 2024
4b19678
Drop py37 support, begin testing again py313
nhairs Apr 27, 2024
0d8b8a1
Fix py313 in GHA
nhairs Apr 27, 2024
3897a97
Don't instlal python on pypy
nhairs Apr 27, 2024
2eb8820
Run py313 in py313...
nhairs Apr 27, 2024
bc2b96e
Avoid orjson on python 3.13 while its not supported
nhairs Apr 27, 2024
1441721
Migrate tests to pytest, test OrjsonFormatter where possible
nhairs Apr 28, 2024
c017bef
Update docstrings to use mkdocstrings compatible
nhairs Apr 28, 2024
457a74c
Fix formatting, linting, typing
nhairs Apr 28, 2024
0d2bc65
Remove py37 from tox config
nhairs Apr 28, 2024
0ee6b9a
Maintain backwards compatibility
nhairs Apr 29, 2024
a0b595b
Add more tests
nhairs Apr 30, 2024
77dcdae
Add support for deprecated json.RESERVED_ATTRS
nhairs Apr 30, 2024
b61fc98
fix assert in test
nhairs May 1, 2024
89f0820
Update test names
nhairs May 3, 2024
a2df91b
Add support for msgspec
nhairs May 3, 2024
44c610d
Fix msgspec specifiers
nhairs May 3, 2024
32f763f
simplify ORJSON_AVAILABLE check
nhairs May 3, 2024
487388c
Update README and CHANGELOG
nhairs May 3, 2024
5cc6e3d
Fix formatting
nhairs May 3, 2024
ce76b66
Add other encoders to README
nhairs May 5, 2024
44406d3
Update freezegun issue references
nhairs May 5, 2024
5a6b959
Remove optional dependencies for specific encoders
nhairs May 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add more tests
  • Loading branch information
nhairs committed Apr 30, 2024
commit a0b595bd2843d5b1fde2804a3648a2862a502d64
20 changes: 20 additions & 0 deletions tests/test_deprecation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### IMPORTS
### ============================================================================
## Future
from __future__ import annotations

## Standard Library

## Installed
import pytest

## Application
import pythonjsonlogger


### TESTS
### ============================================================================
def test_jsonlogger_deprecated():
with pytest.deprecated_call():
pythonjsonlogger.jsonlogger
return
14 changes: 12 additions & 2 deletions tests/test_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

## Application
import pythonjsonlogger
from pythonjsonlogger.core import RESERVED_ATTRS, BaseJsonFormatter
from pythonjsonlogger.core import RESERVED_ATTRS, BaseJsonFormatter, merge_record_extra
from pythonjsonlogger.json import JsonFormatter

if pythonjsonlogger.ORJSON_AVAILABLE:
Expand Down Expand Up @@ -79,7 +79,17 @@ def get_traceback_from_exception_followed_by_log_call(env_: LoggingEnvironment)

### TESTS
### ============================================================================
## Common Tests
def test_merge_record_extra():
record = logging.LogRecord(
"name", level=1, pathname="", lineno=1, msg="Some message", args=None, exc_info=None
)
output = merge_record_extra(record, target={"foo": "bar"}, reserved=[])
assert output["foo"] == "bar"
assert output["msg"] == "Some message"
return


## Common Formatter Tests
## -----------------------------------------------------------------------------
@pytest.mark.parametrize("class_", ALL_FORMATTERS)
def test_default_format(env: LoggingEnvironment, class_: type[BaseJsonFormatter]):
Expand Down
24 changes: 0 additions & 24 deletions tests/test_jsonlogger.py

This file was deleted.

Loading