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

disable Project #1709

Merged
merged 12 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
7 changes: 6 additions & 1 deletion src/neptune/objects/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
from typing_extensions import Literal

from neptune.envs import CONNECTION_MODE
from neptune.exceptions import InactiveProjectException
from neptune.exceptions import (
InactiveProjectException,
NeptuneUnsupportedFunctionalityException,
)
from neptune.internal.backends.api_model import ApiExperiment
from neptune.internal.container_type import ContainerType
from neptune.internal.exceptions import NeptuneException
Expand Down Expand Up @@ -149,6 +152,8 @@ def __init__(
async_no_progress_callback: Optional[NeptuneObjectCallback] = None,
async_no_progress_threshold: float = ASYNC_NO_PROGRESS_THRESHOLD,
):
raise NeptuneUnsupportedFunctionalityException

verify_type("mode", mode, (str, type(None)))

# make mode proper Enum instead of string
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

AVAILABLE_CONTAINERS = ["project", "run"]
AVAILABLE_CONTAINERS = [
pytest.param("project"),
pytest.param("run"),
pytest.param("project", marks=pytest.mark.xfail(reason="Project not supported", strict=True)),
pytest.param(
"model",
marks=pytest.mark.xfail(
Expand Down
10 changes: 8 additions & 2 deletions tests/e2e/management/test_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,18 @@ class TestDeleteFromTrash:
@pytest.mark.parametrize(
("n_runs", "n_models"),
[
(2, 0),
pytest.param(
2,
0,
marks=pytest.mark.xfail(
reason="Project is not supported", strict=True, raises=NeptuneUnsupportedFunctionalityException
),
),
pytest.param(
2,
1,
marks=pytest.mark.xfail(
reason="Model is not supported", strict=True, raises=NeptuneUnsupportedFunctionalityException
reason="Project is not supported", strict=True, raises=NeptuneUnsupportedFunctionalityException
Raalsky marked this conversation as resolved.
Show resolved Hide resolved
),
),
],
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/standard/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def test_tracking_uncommitted_changes(self, repo, environment):
assert "some-content" in fp.read()


@pytest.mark.xfail(reason="Project is not supported", strict=True, raises=NeptuneUnsupportedFunctionalityException)
class TestInitProject(BaseE2ETest):
def test_resuming_project(self, environment):
exp = neptune.init_project(project=environment.project)
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/neptune/new/client/test_model_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import unittest
from typing import List

import pytest

from neptune import init_project
from neptune.exceptions import NeptuneUnsupportedFunctionalityException
from neptune.internal.container_type import ContainerType
from neptune.table import (
Table,
Expand All @@ -26,6 +29,7 @@
from tests.unit.neptune.new.client.abstract_tables_test import AbstractTablesTestMixin


@pytest.mark.xfail(reason="Project not supported", strict=True, raises=NeptuneUnsupportedFunctionalityException)
class TestModelTables(AbstractTablesTestMixin, unittest.TestCase):
expected_container_type = ContainerType.MODEL

Expand Down
13 changes: 12 additions & 1 deletion tests/unit/neptune/new/client/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import unittest
from datetime import datetime

import pytest
from mock import patch

from neptune import (
Expand All @@ -27,7 +28,10 @@
API_TOKEN_ENV_NAME,
PROJECT_ENV_NAME,
)
from neptune.exceptions import NeptuneMissingProjectNameException
from neptune.exceptions import (
NeptuneMissingProjectNameException,
NeptuneUnsupportedFunctionalityException,
)
from neptune.internal.backends.api_model import (
Attribute,
AttributeType,
Expand All @@ -49,6 +53,7 @@
from tests.unit.neptune.new.client.abstract_experiment_test_mixin import AbstractExperimentTestMixin


@pytest.mark.xfail(reason="Project not supported", strict=True, raises=NeptuneUnsupportedFunctionalityException)
@patch(
"neptune.internal.backends.neptune_backend_mock.NeptuneBackendMock.get_attributes",
new=lambda _, _uuid, _type: [Attribute("test", AttributeType.STRING)],
Expand All @@ -70,6 +75,12 @@ def setUp(cls) -> None:
if PROJECT_ENV_NAME in os.environ:
del os.environ[PROJECT_ENV_NAME]

@pytest.mark.skip(
(
"By coincidence, the test is passing as "
"NeptuneUnsupportedFunctionalityException is subclass of NeptuneException"
)
)
def test_offline_mode(self):
with self.assertRaises(NeptuneException):
with init_project(project=self.PROJECT_NAME, mode="offline"):
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/neptune/new/client/test_run_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
from datetime import datetime
from typing import List

import pytest
from mock import patch

from neptune import init_project
from neptune.exceptions import NeptuneUnsupportedFunctionalityException
from neptune.internal.backends.api_model import (
AttributeType,
AttributeWithProperties,
Expand All @@ -36,6 +38,7 @@
from tests.unit.neptune.new.client.abstract_tables_test import AbstractTablesTestMixin


@pytest.mark.xfail(reason="Project not supported", strict=True, raises=NeptuneUnsupportedFunctionalityException)
class TestRunTables(AbstractTablesTestMixin, unittest.TestCase):
expected_container_type = ContainerType.RUN

Expand All @@ -52,7 +55,7 @@ def test_fetch_runs_table_is_case_insensitive(self):
with self.subTest(state):
try:
self.get_table(state=state)
except Exception as e:
except ValueError as e:
self.fail(e)

@patch("neptune.internal.backends.factory.HostedNeptuneBackend", NeptuneBackendMock)
Expand Down
Loading