Skip to content
Open
Changes from all 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
8 changes: 3 additions & 5 deletions serve/test_mixed_gpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ def alive(self):

class TestMixedGpus(unittest.TestCase):
def test_auto_where_found(self):
real = (MG.nvidia_listed, MG.windows, MG.Path.is_file)
real = (MG.nvidia_listed, MG.windows, MG.Path.is_file, MG.AUTO)
try:
MG.Path.is_file = lambda self: True
MG.windows = lambda: False
MG.nvidia_listed = lambda: False # (no NVIDIA card: as before)
self.assertIsNone(MG.config_of(dict(CFG)))
MG.nvidia_listed = lambda: True # (a card and a CUDA build: on by itself where AUTO)
auto, MG.AUTO = MG.AUTO, False
MG.AUTO = False
self.assertIsNone(MG.config_of(dict(CFG))) # (AUTO False: only said)
MG.AUTO = True
self.assertEqual(MG.config_of(dict(CFG))["layers"], "auto")
Expand All @@ -40,9 +40,7 @@ def test_auto_where_found(self):
MG.windows = lambda: True # (Windows: as before)
self.assertIsNone(MG.config_of(dict(CFG)))
finally:
MG.nvidia_listed, MG.windows, MG.Path.is_file = real
MG.AUTO = auto
MG.AUTO = False
MG.nvidia_listed, MG.windows, MG.Path.is_file, MG.AUTO = real

def test_off_when_not_found(self):
real = MG.nvidia_listed
Expand Down