Skip to content

Start fixing some of the issues reported by the pipeline #85

Start fixing some of the issues reported by the pipeline

Start fixing some of the issues reported by the pipeline #85

Triggered via push January 24, 2025 16:29
Status Failure
Total duration 36s
Artifacts

main.yaml

on: push
Matrix: test
tag, changelog, release, publish
0s
tag, changelog, release, publish
Fit to window
Zoom out
Zoom in

Annotations

33 errors and 5 warnings
pydocstyle
Process completed with exit code 1.
tests/unit/datacosmos/client/test_client_delete_request.py#L2
from config.config import Config from datacosmos.client import DatacosmosClient -@patch( - "datacosmos.client.DatacosmosClient._authenticate_and_initialize_client" -) +@patch("datacosmos.client.DatacosmosClient._authenticate_and_initialize_client") def test_delete_request(mock_auth_client): """ Test that the client performs a DELETE request correctly. """ # Mock the HTTP client
tests/unit/datacosmos/client/test_client_get_request.py#L2
from config.config import Config from datacosmos.client import DatacosmosClient -@patch( - "datacosmos.client.DatacosmosClient._authenticate_and_initialize_client" -) +@patch("datacosmos.client.DatacosmosClient._authenticate_and_initialize_client") def test_client_get_request(mock_auth_client): """ Test that the client performs a GET request correctly. """ # Mock the HTTP client
tests/unit/datacosmos/client/test_client_initialization.py#L2
from config.config import Config from datacosmos.client import DatacosmosClient -@patch( - "datacosmos.client.DatacosmosClient._authenticate_and_initialize_client" -) +@patch("datacosmos.client.DatacosmosClient._authenticate_and_initialize_client") @patch("os.path.exists", return_value=False) @patch("config.Config.from_env") def test_client_initialization(mock_from_env, mock_exists, mock_auth_client): """ Test that the client initializes correctly with environment variables and mocks the HTTP client.
tests/unit/datacosmos/client/test_client_post_request.py#L2
from config.config import Config from datacosmos.client import DatacosmosClient -@patch( - "datacosmos.client.DatacosmosClient._authenticate_and_initialize_client" -) +@patch("datacosmos.client.DatacosmosClient._authenticate_and_initialize_client") def test_post_request(mock_auth_client): """ Test that the client performs a POST request correctly. """ # Mock the HTTP client
tests/unit/datacosmos/client/test_client_post_request.py#L24
client_secret="test-client-secret", token_url="https://mock.token.url/oauth/token", audience="https://mock.audience", ) client = DatacosmosClient(config=config) - response = client.post( - "https://mock.api/some-endpoint", json={"key": "value"} - ) + response = client.post("https://mock.api/some-endpoint", json={"key": "value"}) # Assertions assert response.status_code == 201 assert response.json() == {"message": "created"} mock_http_client.request.assert_called_once_with(
tests/unit/datacosmos/client/test_client_put_request.py#L2
from config.config import Config from datacosmos.client import DatacosmosClient -@patch( - "datacosmos.client.DatacosmosClient._authenticate_and_initialize_client" -) +@patch("datacosmos.client.DatacosmosClient._authenticate_and_initialize_client") def test_put_request(mock_auth_client): """ Test that the client performs a PUT request correctly. """ # Mock the HTTP client
tests/unit/datacosmos/client/test_client_token_refreshing.py#L3
from config.config import Config from datacosmos.client import DatacosmosClient -@patch( - "datacosmos.client.DatacosmosClient._authenticate_and_initialize_client" -) +@patch("datacosmos.client.DatacosmosClient._authenticate_and_initialize_client") def test_client_token_refreshing(mock_auth_client): """ Test that the client refreshes the token when it expires. """ # Mock the HTTP client returned by _authenticate_and_initialize_client
datacosmos/client.py#L42
""" try: if os.path.exists(config_file): self.logger.info(f"Loading configuration from {config_file}") return Config.from_yaml(config_file) - self.logger.info( - "Loading configuration from environment variables" - ) + self.logger.info("Loading configuration from environment variables") return Config.from_env() except Exception as e: self.logger.error(f"Failed to load configuration: {e}") raise
build/lib/config/__init__.py#L3
Line too long (85 > 79 characters) (E501)
datacosmos/client.py#L75
) self.logger.info("Authentication successful, token obtained") # Initialize the HTTP session with the Authorization header http_client = requests.Session() - http_client.headers.update( - {"Authorization": f"Bearer {self.token}"} - ) + http_client.headers.update({"Authorization": f"Bearer {self.token}"}) return http_client except RequestException as e: self.logger.error(f"Request failed during authentication: {e}") raise except Exception as e:
build/lib/config/config.py#L16
Line too long (87 > 79 characters) (E501)
build/lib/datacosmos/client.py#L16
Line too long (80 > 79 characters) (E501)
build/lib/datacosmos/client.py#L17
Line too long (81 > 79 characters) (E501)
build/lib/datacosmos/client.py#L28
Line too long (82 > 79 characters) (E501)
build/lib/datacosmos/client.py#L41
Line too long (105 > 79 characters) (E501)
build/lib/datacosmos/client.py#L101
Line too long (80 > 79 characters) (E501)
build/lib/datacosmos/client.py#L119
Line too long (80 > 79 characters) (E501)
build/lib/tests/unit/datacosmos/client/test_client_authentication.py#L1
'unittest.mock.MagicMock' imported but unused (F401)
build/lib/tests/unit/datacosmos/client/test_client_initialization.py#L14
Line too long (100 > 79 characters) (E501)
config/__init__.py#L3
Line too long (85 > 79 characters) (E501)
config/config.py#L16
Line too long (87 > 79 characters) (E501)
datacosmos/client.py#L16
Line too long (80 > 79 characters) (E501)
datacosmos/client.py#L17
Line too long (81 > 79 characters) (E501)
datacosmos/client.py#L28
Line too long (82 > 79 characters) (E501)
datacosmos/client.py#L41
Line too long (105 > 79 characters) (E501)
datacosmos/client.py#L101
Line too long (80 > 79 characters) (E501)
datacosmos/client.py#L119
Line too long (80 > 79 characters) (E501)
tests/unit/datacosmos/client/test_client_authentication.py#L1
'unittest.mock.MagicMock' imported but unused (F401)
tests/unit/datacosmos/client/test_client_initialization.py#L14
Line too long (100 > 79 characters) (E501)
bandit
Process completed with exit code 1.
cognitive
Process completed with exit code 1.
lint
Linting failures detected. See check runs with annotations for details.
pydocstyle
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
bandit
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
cognitive
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
lint
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
isort
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636