-
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.
add levels to usage tracking, move tests to units dir
- Loading branch information
1 parent
afde2dd
commit 0792a5a
Showing
7 changed files
with
61 additions
and
94 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
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
"""Test usage_tracking values.""" | ||
|
||
import pytest | ||
|
||
import parsl | ||
from parsl.config import Config | ||
from parsl.errors import ConfigurationError | ||
from typeguard import TypeCheckError | ||
|
||
|
||
@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(TypeCheckError): | ||
Config(usage_tracking=level) |
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