Skip to content

Commit 8d9ba58

Browse files
committed
CHANGELOG entry and doc fix
CHANGELOG.rst Added entry for the PR tests/test_explicit_profile.py test_explicit_profile_with_duplicate_functions() Reworded docstring
1 parent 79f96c8 commit 8d9ba58

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Changes
99
* FIX: Fixed auto-profiling of async function definitions #330
1010
* ENH: Added CLI argument ``-m`` to ``kernprof`` for running a library module as a script; also made it possible for profiling targets to be supplied across multiple ``-p`` flags
1111
* FIX: Fixed explicit profiling of class methods; added handling for profiling static, bound, and partial methods, ``functools.partial`` objects, (cached) properties, and async generator functions
12+
* ENH: Added CLI argument ``-e``/``--eager-preimports`` to profile target entities even when they aren't directly imported in the run script/module; made on-import profiling more aggressive so that it doesn't miss entities like class methods and properties
1213

1314
4.2.0
1415
~~~~~

tests/test_explicit_profile.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,10 @@ def func4(a):
415415
def test_profiler_add_methods(wrap_class, wrap_module, reset_enable_count):
416416
"""
417417
Test the `wrap` argument for the
418+
`LineProfiler.add_class()`, `.add_module()`, and
419+
`.add_imported_function_or_module()` (added via
418420
`line_profiler.autoprofile.autoprofile.
419-
_extend_line_profiler_for_profiling_imports()`,
420-
`LineProfiler.add_class()` and `.add_module()` methods.
421+
_extend_line_profiler_for_profiling_imports()`) methods.
421422
"""
422423
def write(path, code):
423424
path.write_text(ub.codeblock(code))
@@ -434,7 +435,9 @@ def write(path, code):
434435
435436
profiler = LineProfiler()
436437
upgrade_profiler(profiler)
438+
# This dispatches to `.add_module()`
437439
profiler.add_imported_function_or_module(my_module_1{})
440+
# This dispatches to `.add_class()`
438441
profiler.add_imported_function_or_module(Class{})
439442
profiler.add_imported_function_or_module(func3)
440443

0 commit comments

Comments
 (0)