• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SwissDataScienceCenter / renku-data-services / 18099160032

29 Sep 2025 01:45PM UTC coverage: 83.309% (-3.4%) from 86.756%
18099160032

Pull #1015

github

web-flow
Merge a03635015 into 0690bab65
Pull Request #1015: fix: loading kube configs

23 of 68 new or added lines in 8 files covered. (33.82%)

892 existing lines in 42 files now uncovered.

21422 of 25714 relevant lines covered (83.31%)

1.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

56.52
/components/renku_data_services/notebooks/api/classes/user.py
1
"""Notebooks user model definitions."""
2

3
from functools import lru_cache
2✔
4

5
from gitlab import Gitlab
2✔
6
from gitlab.v4.objects.projects import Project
2✔
7
from gitlab.v4.objects.users import CurrentUser
2✔
8

9
from renku_data_services.app_config import logging
2✔
10

11
logger = logging.getLogger(__name__)
2✔
12

13

14
@lru_cache(maxsize=8)
2✔
15
def _get_project(client: Gitlab, namespace_project: str) -> Project:
2✔
16
    return client.projects.get(f"{namespace_project}")
×
17

18

19
class NotebooksGitlabClient:
2✔
20
    """Client for gitlab to be used only in the notebooks, will be eventually eliminated."""
21

22
    def __init__(self, url: str, gitlab_token: str | None = None):
2✔
UNCOV
23
        self.gitlab_client = Gitlab(url, api_version="4", oauth_token=gitlab_token, per_page=50)
×
24

25
    @property
2✔
26
    def gitlab_user(self) -> CurrentUser | None:
2✔
27
        """Get the Gitlab user."""
28
        if not getattr(self.gitlab_client, "user", None):
×
29
            self.gitlab_client.auth()
×
30
        return self.gitlab_client.user
×
31

32
    def get_renku_project(self, namespace_project: str) -> Project | None:
2✔
33
        """Retrieve the GitLab project."""
UNCOV
34
        try:
×
UNCOV
35
            return _get_project(self.gitlab_client, namespace_project)
×
36
        except Exception as e:
×
37
            logger.warning(f"Cannot find the gitlab project: {namespace_project}, error: {e}")
×
38
        return None
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc