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

Drop repo client tests #1087

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/seer/automation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ class RepoDefinition(BaseModel):
provider: Annotated[str, Examples(("github", "integrations:github"))]
owner: str
name: str
external_id: Annotated[str, Examples(specialized.ascii_words)]
external_id: str = ""
base_commit_sha: Optional[str] = None

@property
Expand Down
16 changes: 12 additions & 4 deletions src/seer/dependency_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ def provider(self, c: _C) -> _C:
self.registry[key] = c
return c

def constant(self, annotation: type[_A], val: _A) -> _A:
def constant(self, annotation: type[_A], val: _A) -> "Module":
key = FactoryAnnotation.from_annotation(annotation)
self.registry[key] = lambda: val
return val
return self

def enable(self):
injector = Injector(self, _cur.injector)
Expand All @@ -163,6 +163,14 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:

return wrapper # type: ignore

def __call__(self, c: _CK) -> _CK:
@functools.wraps(c)
def wrapper(*args: Any, **kwargs: Any) -> Any:
with self:
return c(*args, **kwargs)

return wrapper # type: ignore

def __enter__(self):
return self.enable()

Expand Down Expand Up @@ -216,12 +224,12 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:

if d is injected and len(args) <= arg_idx and arg_name not in new_kwds:
try:
resolved = resolve(argspec.annotations[arg_name])
annotation = argspec.annotations[arg_name]
except KeyError:
raise AssertionError(
f"Cannot inject argument {arg_name} as it lacks annotations"
)

resolved = resolve(annotation)
new_kwds[arg_name] = resolved

if argspec.kwonlydefaults:
Expand Down
Loading
Loading