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

test(logging): add profiling test #2016

Merged
merged 2 commits into from Feb 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 21 additions & 1 deletion tests/unit/logging/test_logging_profile.py
@@ -1,6 +1,26 @@
import time

from jina.logging.profile import TimeDict
import pytest

from jina.logging import default_logger
from jina.logging.profile import TimeDict, profiling


@pytest.fixture
def default_logger_propagate():
default_logger.logger.propagate = True
yield
default_logger.logger.propagate = False


def test_logging_profile_profiling(caplog, default_logger_propagate):
@profiling
def foo():
time.sleep(1)

foo()
# profiling format: JINA@79684[I]: foo time: 0.00042528799999996814s memory Δ 376.0 KB 47.3 MB -> 47.7 MB
assert 'time' in caplog.text


def test_logging_profile_timedict():
Expand Down