-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c9d02e
commit 9c2658e
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# coding=utf-8 | ||
""" | ||
Tomorrow Now GAP. | ||
.. note:: Unit tests for Zarr Utilities. | ||
""" | ||
|
||
from django.test import TestCase | ||
|
||
from gap.models import Preferences | ||
from gap.utils.dask import execute_dask_compute | ||
|
||
|
||
class MockDelayed(object): | ||
"""Mock class for delayed object.""" | ||
|
||
def compute(self): | ||
"""Mock compute method.""" | ||
pass | ||
|
||
|
||
class TestDaskUtils(TestCase): | ||
"""Unit test for dask utilities.""" | ||
|
||
def test_empty_num_of_threads(self): | ||
"""Test num_of_threads is not set.""" | ||
preferences = Preferences.load() | ||
preferences.dask_threads_num = -1 | ||
preferences.save() | ||
execute_dask_compute(MockDelayed()) | ||
|
||
def test_use_num_of_threads(self): | ||
"""Test num_of_threads is set to 1.""" | ||
preferences = Preferences.load() | ||
preferences.dask_threads_num = 1 | ||
preferences.save() | ||
execute_dask_compute(MockDelayed()) |