Skip to content

Commit

Permalink
make ut in macos works
Browse files Browse the repository at this point in the history
  • Loading branch information
jialeicui committed Sep 28, 2023
1 parent 00a0a5f commit 578f27b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions client/tests/core/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import json
import typing as t
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch, MagicMock

import yaml
from click.testing import CliRunner
from requests_mock import Mocker
from pyfakefs.fake_filesystem_unittest import TestCase

from tests import ROOT_DIR
from tests import ROOT_DIR, BaseTestCase
from starwhale.utils import config as sw_config
from starwhale.utils import load_yaml
from starwhale.consts import (
Expand Down Expand Up @@ -45,11 +45,7 @@
_dataset_yaml = open(f"{_dataset_data_dir}/dataset.yaml").read()


class StandaloneDatasetTestCase(TestCase):
def setUp(self) -> None:
self.setUpPyfakefs()
sw_config._config = {}

class StandaloneDatasetTestCase(BaseTestCase):
@patch("starwhale.base.uri.resource.Resource._refine_local_rc_info")
@patch("starwhale.api._impl.dataset.model.Dataset.commit")
@patch("starwhale.api._impl.dataset.model.Dataset.__setitem__")
Expand Down Expand Up @@ -382,7 +378,7 @@ def __iter__(self) -> t.Generator:

sw = SWCliConfigMixed()

workdir = "/home/starwhale/myproject"
workdir = self.local_storage
name = "mnist"

ensure_dir(os.path.join(workdir, "data"))
Expand Down Expand Up @@ -419,7 +415,7 @@ def __iter__(self) -> t.Generator:
assert isinstance(_info, LocalDatasetInfo)
assert _info.version == build_version
assert _info.name == name
assert _info.path == str(snapshot_workdir.resolve())
assert str(Path(_info.path).resolve()) == str(snapshot_workdir.resolve())

tags = sd.tag.list()
assert set(tags) == {"t0", "t1", "latest", "v0"}
Expand Down

0 comments on commit 578f27b

Please sign in to comment.