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

fix AttributeError thrown by str.removeprefix when python < 3.9 #259

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

shtlrs
Copy link
Contributor

@shtlrs shtlrs commented Mar 11, 2024

Closes #252

Sorry for that, I forgot about the python 3.8 support.

@shtlrs shtlrs force-pushed the 252-fix-remove-prefix-bug branch 2 times, most recently from 88782db to e286d00 Compare March 11, 2024 06:57
@supakeen
Copy link
Owner

supakeen commented Mar 11, 2024

Thanks, interesting CI failures on this PR. Expected?

@shtlrs
Copy link
Contributor Author

shtlrs commented Mar 11, 2024

It's due to where the patch is being made I think.

I know that patching has this kinds of gotchas however I'm using pytest's monkeypatch and rn idk really know why it's happening.

I'll have a proper look later on.

@shtlrs
Copy link
Contributor Author

shtlrs commented Mar 11, 2024

@supakeen It's fixed now.

I think the problem lies within the design of the provider class.

During the test runtime/startup time, the get_config could be called by some test, so the _config cls isntance is set, which mean s that it has already loaded the environment before the patching happens, and thus, all subsequent calls will use that class instance instead of making a fresh one & loading the patched env.

I opted for instantiation Configuration directly here since we're only testing something "trivial" and there's no application logic.

@supakeen
Copy link
Owner

Thanks yea, we can probably fix that issue when it's used by multiple tests and it becomes a chore.

@supakeen supakeen merged commit d2098a9 into supakeen:master Mar 11, 2024
11 checks passed
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.

removeprefix is not compatible with Python 3.8
2 participants