Skip to content

Commit

Permalink
fix(ci): unittest failed (#2908)
Browse files Browse the repository at this point in the history
  • Loading branch information
bojiang committed Aug 15, 2022
1 parent 3ec89ec commit f9997c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/unit/_internal/runner/test_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import os
import typing as t

import pytest

if t.TYPE_CHECKING:
from _pytest.monkeypatch import MonkeyPatch

Expand All @@ -23,7 +25,9 @@ def unvalidated_get_resource(x: t.Dict[str, t.Any], y: str):
def test_default_gpu_strategy(monkeypatch: MonkeyPatch):
monkeypatch.setattr(strategy, "get_resource", unvalidated_get_resource)
assert DefaultStrategy.get_worker_count(GPURunnable, {"nvidia.com/gpu": 2}) == 2
assert DefaultStrategy.get_worker_count(GPURunnable, {"nvidia.com/gpu": 0}) == 1
assert pytest.raises(
ValueError, DefaultStrategy.get_worker_count, GPURunnable, {"nvidia.com/gpu": 0}
)
assert (
DefaultStrategy.get_worker_count(GPURunnable, {"nvidia.com/gpu": [2, 7]}) == 2
)
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/_internal/test_store.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import time
import typing as t
from typing import TYPE_CHECKING
from datetime import datetime
Expand Down Expand Up @@ -76,9 +77,13 @@ def test_store(tmpdir: "Path"):
DummyItem.store = store
oldtime = datetime.now()
DummyItem.create("test:version1")
time.sleep(1)
DummyItem.create("test:otherprefix")
time.sleep(1)
DummyItem.create(Tag("test", "version2"))
time.sleep(1)
DummyItem.create("test:version3", creation_time=oldtime)
time.sleep(1)
DummyItem.create("test1:version1")
with pytest.raises(BentoMLException):
DummyItem.create("test:version2")
Expand Down

0 comments on commit f9997c5

Please sign in to comment.