-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from wimglenn/issue18
v0.5
- Loading branch information
Showing
6 changed files
with
81 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: tests | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
name: "Python ${{ matrix.python-version }}" | ||
runs-on: "ubuntu-latest" | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["2.7", "3.9"] | ||
|
||
steps: | ||
- uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v2" | ||
with: | ||
python-version: "${{ matrix.python-version }}" | ||
- name: "Install" | ||
run: | | ||
set -xe | ||
python -VV | ||
python -m pip install --editable . | ||
- name: "Run tests for ${{ matrix.python-version }}" | ||
run: python -m pytest |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import pytest | ||
|
||
import structlog | ||
|
||
|
||
logger = structlog.get_logger(__name__) | ||
|
||
|
||
@pytest.fixture | ||
def stdlib_configure(): | ||
structlog.configure( | ||
processors=[ | ||
structlog.stdlib.filter_by_level, | ||
structlog.stdlib.add_logger_name, | ||
structlog.stdlib.add_log_level, | ||
structlog.stdlib.PositionalArgumentsFormatter(), | ||
structlog.processors.TimeStamper(fmt="iso"), | ||
structlog.processors.StackInfoRenderer(), | ||
structlog.processors.format_exc_info, | ||
structlog.dev.ConsoleRenderer(), | ||
], | ||
logger_factory=structlog.stdlib.LoggerFactory(), | ||
wrapper_class=structlog.stdlib.BoundLogger, | ||
context_class=structlog.threadlocal.wrap_dict(dict), | ||
) | ||
|
||
|
||
def test_positional_formatting(stdlib_configure, log): | ||
items_count = 2 | ||
dt = 0.02 | ||
logger.info("Processed %d CC items in total in %.2f seconds", items_count, dt) | ||
assert log.has("Processed 2 CC items in total in 0.02 seconds", level="info") |