Skip to content

Commit

Permalink
disable Project (#1709)
Browse files Browse the repository at this point in the history
Co-authored-by: Szymon Sadkowski <[email protected]>
  • Loading branch information
2 people authored and Raalsky committed Mar 25, 2024
1 parent d72de10 commit 2cd91a3
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Deleted `neptune.logging` package ([#1698](https://github.com/neptune-ai/neptune-client/pull/1698))
- Disabled `Model` ([#1701](https://github.com/neptune-ai/neptune-client/pull/1701))
- Disabled `ModelVersion` ([#1701](https://github.com/neptune-ai/neptune-client/pull/1708))
- Disabled `Project` ([#1709](https://github.com/neptune-ai/neptune-client/pull/1709))

### Features
- ?
Expand Down
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 @@ -511,12 +511,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
),
),
],
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 @@ -48,6 +52,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 @@ -69,6 +74,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 @@ -35,6 +37,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 @@ -51,7 +54,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

0 comments on commit 2cd91a3

Please sign in to comment.