forked from microsoft/MLOS
-
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
Showing
2 changed files
with
84 additions
and
9 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
36 changes: 36 additions & 0 deletions
36
mlos_bench/mlos_bench/tests/storage/trial_telemetry_test_alt_tz.py
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,36 @@ | ||
# | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
# | ||
""" | ||
Unit tests for saving and restoring the telemetry data when host timezone is in a different timezone. | ||
""" | ||
|
||
from subprocess import run | ||
import os | ||
import sys | ||
from typing import Optional | ||
|
||
import pytest | ||
|
||
# pylint: disable=redefined-outer-name | ||
|
||
|
||
@pytest.mark.skipif(sys.platform == 'win32', reason="sh-like shell only") | ||
@pytest.mark.parametrize(("tz_name"), [None, "America/Chicago", "America/Los_Angeles", "UTC"]) | ||
def test_trial_telemetry_alt_tz(tz_name: Optional[str]) -> None: | ||
""" | ||
Run the trial telemetry tests under alternative default (un-named) TZ info. | ||
""" | ||
env = os.environ.copy() | ||
if tz_name is None: | ||
env.pop("TZ", None) | ||
else: | ||
env["TZ"] = tz_name | ||
cmd = run( | ||
[sys.executable, "-m", "pytest", "-n0", f"{os.path.dirname(__file__)}/trial_telemetry_test.py"], | ||
# , "-k", "implicit_local"], | ||
env=env, | ||
check=True, | ||
) | ||
assert cmd.returncode == 0 |