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

Fixe #611: audit fails with custom plugin #621

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

steamraven
Copy link

Clear a lru_cache when creating default_settings

@@ -71,6 +71,7 @@ def default_settings() -> Generator['Settings', None, None]:
for plugin_type in get_mapping_from_secret_type_to_class().values()
],
}) as settings:
get_mapping_from_secret_type_to_class.cache_clear()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much does the performance get affected by adding this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings.defailt_settings is called usually only once to setup the parser or run tests, so performance impact should be minimal

@steamraven
Copy link
Author

Appears the filters.common_filter_test.py makes use of testing.pugins.register_plugin. This contextmanager relies specifically on get_mapping_from_secret_type_to_class having an lru_cache. It actually inserts plugins into the cache. These of course get purged by my code.

I would say this is a problem with the test framework. I will try to find a solution

@lorenzodb1
Copy link
Contributor

lorenzodb1 commented Sep 22, 2022

@steamraven have you manually tested your branch besides running the test suite we have?

@steamraven
Copy link
Author

steamraven commented Sep 22, 2022

I have manually tested with the minimal plugin and baseline and it fixes the issue.
I have and ran pytest with "time python -m pytest tests" . I have not been able to do a full test with tox due to environment setup issues.

It appears I am failing on autopep8 at the moment.

I can try to write up some full tests to test my issue, but that will take bit.

@lorenzodb1
Copy link
Contributor

That's okay, I'd rather have coverage of this. Thank you for your contribution!

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.

3 participants