-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into benc-tmp-sander
- Loading branch information
Showing
5 changed files
with
140 additions
and
27 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
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
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,45 @@ | ||
"""Test usage_tracking values.""" | ||
|
||
import pytest | ||
|
||
import parsl | ||
from parsl.config import Config | ||
from parsl.errors import ConfigurationError | ||
|
||
|
||
@pytest.mark.local | ||
def test_config_load(): | ||
"""Test loading a config with usage tracking.""" | ||
with parsl.load(Config(usage_tracking=3)): | ||
pass | ||
parsl.clear() | ||
|
||
|
||
@pytest.mark.local | ||
@pytest.mark.parametrize("level", (0, 1, 2, 3, False, True)) | ||
def test_valid(level): | ||
"""Test valid usage_tracking values.""" | ||
Config(usage_tracking=level) | ||
assert Config(usage_tracking=level).usage_tracking == level | ||
|
||
|
||
@pytest.mark.local | ||
@pytest.mark.parametrize("level", (12, 1000, -1)) | ||
def test_invalid_values(level): | ||
"""Test invalid usage_tracking values.""" | ||
with pytest.raises(ConfigurationError): | ||
Config(usage_tracking=level) | ||
|
||
|
||
@pytest.mark.local | ||
@pytest.mark.parametrize("level", ("abcd", None, bytes(1), 1.0, 1j, object())) | ||
def test_invalid_types(level): | ||
"""Test invalid usage_tracking types.""" | ||
with pytest.raises(Exception) as ex: | ||
Config(usage_tracking=level) | ||
|
||
# with typeguard 4.x this is TypeCheckError, | ||
# with typeguard 2.x this is TypeError | ||
# we can't instantiate TypeCheckError if we're in typeguard 2.x environment | ||
# because it does not exist... so check name using strings. | ||
assert ex.type.__name__ in ["TypeCheckError", "TypeError"] |
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,6 @@ | ||
"""Module for defining the usage tracking levels.""" | ||
|
||
DISABLED = 0 # Tracking is disabled | ||
LEVEL_1 = 1 # Share info about Parsl version, Python version, platform | ||
LEVEL_2 = 2 # Share info about config + level 1 | ||
LEVEL_3 = 3 # Share info about app count, app fails, execution time + level 2 |
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