Skip to content

Read config file options when the command line option is not given - #199

Open
mkzung wants to merge 1 commit into
bloomberg:mainfrom
mkzung:fix/ini-options-reach-the-plugin
Open

mkzung wants to merge 1 commit into
bloomberg:mainfrom
mkzung:fix/ini-options-reach-the-plugin

Conversation

@mkzung

@mkzung mkzung commented Sep 23, 2026

Copy link
Copy Markdown

Fixes #135.

value_or_ini only reads the ini file when the command line value is None, but seven options defaulted to False, 5 or 1, so their ini keys were never read. Those defaults are None now, and the ini keys carry the old defaults instead.

Two more things broke the same path once it was reached. stacks and most_allocations come back from the ini as strings, so they are converted with int(). The fail-on-increase ini key has hyphens while the code looked it up under the option's dest, fail_on_increase, so it is read under its ini name. The README listed most-allocations as the ini key; the registered one is most_allocations.

Four new tests set memray, hide_memray_summary, most_allocations and fail-on-increase in the ini file, and all four fail on main. The full suite passes, as do ruff, black and mypy.

Seven command line options had non-None defaults, so value_or_ini never
fell through to the ini file. stacks and most_allocations come back
from the ini as strings, and fail-on-increase was read under its
option dest rather than its ini key.

Fixes bloomberg#135

Signed-off-by: mkzung <103102868+mkzung@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configuration with pytest.ini not working

1 participant