Skip to content

Commit b393c1a

Browse files
authored
Improve a comment and docstring about memory profiling (DataDog#20643)
* Improve a comment and docstring about memory profiling * add params, replace docstring with better func name
1 parent 4c282e2 commit b393c1a

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

datadog_checks_base/datadog_checks/base/checks/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ def run(self):
12971297

12981298
enter_pdb(self.check, line=self.init_config['set_breakpoint'], args=(instance,))
12991299
elif self.should_profile_memory():
1300-
# self.init_config.get('profile_memory') could be `/tmp/datadog-agent-memory-profiler*`
1300+
# The 'profile_memory' key in self.init_config could be `/tmp/datadog-agent-memory-profiler*`
13011301
# that is generated by Datadog Agent.
13021302
# If we use `--m-dir` for `agent check` command, a hidden flag, it should be same as a given value.
13031303
namespaces = [self.init_config.get('profile_memory')]

datadog_checks_base/tests/base/checks/test_agent_check.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,14 +1312,11 @@ def test_env_var_logic_preset():
13121312
@pytest.mark.parametrize(
13131313
"should_profile_value, expected_calls",
13141314
[
1315-
(True, 1),
1316-
(False, 0),
1315+
pytest.param(True, 1, id="enabled"),
1316+
pytest.param(False, 0, id="disabled"),
13171317
],
13181318
)
1319-
def test_profile_memory(should_profile_value, expected_calls):
1320-
"""
1321-
Test that profile_memory is called when should_profile_memory is True
1322-
"""
1319+
def test_profile_memory_when_enabled(should_profile_value, expected_calls):
13231320
check = AgentCheck('test', {}, [{}])
13241321
check.should_profile_memory = mock.MagicMock(return_value=should_profile_value)
13251322
check.profile_memory = mock.MagicMock()

0 commit comments

Comments
 (0)