-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Nazee Hajebi <2491283+NazeeHajebi@users.noreply.github.com> Co-Authored-By: blade290 <43077216+blade290@users.noreply.github.com> Co-Authored-By: Nitsan Avni <nitsanav@gmail.com> Co-Authored-By: Lev Konstantinovskiy <1261528+tmylk@users.noreply.github.com> Co-Authored-By: T. E. Green <78671457+Tegsy@users.noreply.github.com>
- Loading branch information
1 parent
0ae8d37
commit 917ab6e
Showing
9 changed files
with
83 additions
and
1 deletion.
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
Empty file.
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 logging | ||
from datetime import datetime | ||
from typing import Optional, ContextManager | ||
|
||
from approvaltests import Options, verify | ||
from testfixtures import LogCapture | ||
|
||
from approvaltests.scrubbers.date_scrubber import DateScrubber | ||
|
||
def verify_logging( | ||
*, # enforce keyword arguments - https://www.python.org/dev/peps/pep-3102/ | ||
options: Optional[Options] = None | ||
) -> ContextManager: | ||
class VerifyLogging: | ||
def __init__(self): | ||
self.l = LogCapture() | ||
self.output = "anything" | ||
self.options = options | ||
if not options: | ||
self.options = Options() | ||
|
||
def __enter__(self): | ||
self.l.__enter__() | ||
|
||
pass | ||
|
||
def __exit__(self, exc_type, exc_val, exc_tb): | ||
self.l.__exit__(exc_type, exc_val, exc_tb) | ||
self.options = self.options.with_scrubber(DateScrubber.get_scrubber_for("2023-07-16 17:39:03.293919")) | ||
verify(self.l, options=self.options) | ||
|
||
return VerifyLogging() |
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ numpy | |
pylint | ||
pytest-asyncio | ||
pytest-xdist | ||
# mariadb | ||
# mariadb |
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,38 @@ | ||
import logging | ||
from datetime import datetime | ||
from typing import Optional, ContextManager | ||
|
||
from approvaltests import Options, verify | ||
from testfixtures import LogCapture | ||
|
||
from approvaltests.scrubbers.date_scrubber import DateScrubber | ||
|
||
|
||
def verify_logging( | ||
*, # enforce keyword arguments - https://www.python.org/dev/peps/pep-3102/ | ||
options: Optional[Options] = None | ||
) -> ContextManager: | ||
class VerifyLogging: | ||
def __init__(self): | ||
self.l = LogCapture() | ||
self.output = "anything" | ||
self.options = options | ||
if not options: | ||
self.options = Options() | ||
def __enter__(self): | ||
self.l.__enter__() | ||
|
||
|
||
pass | ||
|
||
def __exit__(self, exc_type, exc_val, exc_tb): | ||
self.l.__exit__(exc_type, exc_val, exc_tb) | ||
self.options = self.options.with_scrubber(DateScrubber.get_scrubber_for("2023-07-16 17:39:03.293919")) | ||
verify(self.l, options=self.options) | ||
|
||
return VerifyLogging() | ||
|
||
def test_basic_logging(): | ||
with verify_logging(): | ||
logging.info("1") | ||
logging.info(datetime.now()) |
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,4 @@ | ||
root INFO | ||
1 | ||
root INFO | ||
<date0> |
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