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

refactor: rework Entry, Request and Response classes #276

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

betaboon
Copy link
Contributor

@betaboon betaboon commented Nov 30, 2024

I'm sorry, this went a "little" overboard 🙈

So I am opening this PR as a draft, to discuss with you what you think.

I refactored the entry, request and response classes to be ABCs and went from there.

This gets us to almost fully typed, introduces new apis, but keeps all old apis available and cleanly marked as backwards-compat.

I have no good idea to split this up in multiple sensible commits.
I split this PR intro (hopefully) easy to follow, individually working commits.

@coveralls
Copy link

Coverage Status

coverage: 97.727% (-1.0%) from 98.68%
when pulling a69d07e on betaboon:refactor-entry
into 9cfad4c on mindflayer:main.

@coveralls
Copy link

coveralls commented Nov 30, 2024

Coverage Status

coverage: 97.385% (-1.3%) from 98.68%
when pulling 218eb32 on betaboon:refactor-entry
into 9cfad4c on mindflayer:main.

@betaboon betaboon force-pushed the refactor-entry branch 2 times, most recently from 9422982 to 47d07a9 Compare December 2, 2024 09:31
Copy link

sonarqubecloud bot commented Dec 2, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@betaboon
Copy link
Contributor Author

betaboon commented Dec 3, 2024

fyi i have another branch that builds on top of this that gets us to fully typed.

@betaboon betaboon mentioned this pull request Dec 3, 2024
@mindflayer
Copy link
Owner

I'm sorry for not answering before, first I've been sick, then very busy at work. I'll look at both soon.

@betaboon
Copy link
Contributor Author

betaboon commented Dec 5, 2024

Nothing to be sorry. feel better and take your time :)

Copy link
Owner

@mindflayer mindflayer left a comment

Choose a reason for hiding this comment

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

I am not sure I like the concept of mocket.core, in the end it gets most of the code, not very different from having it under mocket.
If you want to make it tidier, maybe something like mocket.decorators for decorators, etc.



class MocketBytesResponse(MocketBaseResponse):
def __init__(self, data: bytes | str | bool) -> None:
Copy link
Owner

Choose a reason for hiding this comment

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

MocketBytesResponse can be created with bytes/str/bool? Isn't it confusing?

@mindflayer
Copy link
Owner

mindflayer commented Dec 12, 2024

I've read the code a bunch of times already, and I have the feeling that Mocket APIs got more complicated than they were before, instead of being simpler and cleaner.
Correct me if I am wrong, maybe I just missed the point here.
It would have been easier if you started from documenting the ideas behind it.

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