refactor: remove the pytest.config compatibility kludge - #47
Merged
Merged
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
`ascenderkit/config.py` carried this, and the comment is the whole story:
```python
def getvalue(self, name):
return self.__getitem__(name)
...
config.getvalue = types.MethodType(getvalue, config)
```
`pytest.config` was the global config object pytest exposed until it was removed in pytest 5.0, in 2019. This bound a method onto `config` so that code written against that API would keep working. Nothing here is written against it: `config.getvalue` has no caller in the package or the tests, and there is no dynamic access either, no `getattr(config, 'getvalue')` and no `config['getvalue']`.
It was redundant even when it worked. `config` is a `PseudoNamespace`, a `dict` subclass that already serves keys as attributes, so `config.getvalue('host')`, `config['host']` and `config.host` were three spellings of one lookup. The thing the CLI actually uses for this is `CLI.get_config`, which reads the parsed `--conf.xyz` flags and is untouched.
Removes the function, the binding and the `import types` that existed only for it.
Verified with `black --check`, `flake8` and the unit suite, 355 passing.
blaipr
force-pushed
the
refactor/drop-pytest-config-kludge
branch
from
September 13, 2026 09:03
152d282 to
7fdc894
Compare
cigamit
approved these changes
Sep 13, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ascenderkit/config.pycarried this, and the comment is the whole story:pytest.configwas the global config object pytest exposed until it was removed in pytest 5.0, in 2019. This bound a method ontoconfigso that code written against that API would keep working. Nothing here is written against it:config.getvaluehas no caller in the package or the tests, and there is no dynamic access either, nogetattr(config, 'getvalue')and noconfig['getvalue'].It was redundant even when it worked.
configis aPseudoNamespace, adictsubclass that already serves keys as attributes, soconfig.getvalue('host'),config['host']andconfig.hostwere three spellings of one lookup. The thing the CLI actually uses for this isCLI.get_config, which reads the parsed--conf.xyzflags and is untouched.Removes the function, the binding and the
import typesthat existed only for it.Verified with
black --check,flake8and the unit suite, 355 passing.