Bump pytest to 7.0.0 (#65981)

This commit is contained in:
Tobias Sauerwein 2022-02-08 10:03:27 +01:00 committed by GitHub
parent a03d8179d0
commit 8b38fa58aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 5 deletions

View File

@ -25,7 +25,7 @@ pytest-test-groups==1.0.3
pytest-sugar==0.9.4
pytest-timeout==2.1.0
pytest-xdist==2.4.0
pytest==6.2.5
pytest==7.0.0
requests_mock==1.9.2
respx==0.19.0
stdlib-list==0.7.0

View File

@ -39,8 +39,11 @@ def setup_comp(hass):
)
@pytest.fixture(autouse=True)
def teardown():
"""Restore."""
yield
dt_util.set_default_time_zone(ORIG_TIME_ZONE)

View File

@ -46,8 +46,11 @@ def setup_comp(hass):
)
@pytest.fixture(autouse=True)
def teardown():
"""Restore."""
yield
dt_util.set_default_time_zone(ORIG_TIME_ZONE)

View File

@ -46,8 +46,11 @@ from tests.common import async_fire_time_changed
DEFAULT_TIME_ZONE = dt_util.DEFAULT_TIME_ZONE
@pytest.fixture(autouse=True)
def teardown():
"""Stop everything that was started."""
yield
dt_util.set_default_time_zone(DEFAULT_TIME_ZONE)

View File

@ -53,8 +53,11 @@ def create_file(path):
pass
@pytest.fixture(autouse=True)
def teardown():
"""Clean up."""
yield
dt_util.DEFAULT_TIME_ZONE = ORIG_TIMEZONE
if os.path.isfile(YAML_PATH):
@ -78,6 +81,11 @@ def teardown():
async def test_create_default_config(hass):
"""Test creation of default config."""
assert not os.path.isfile(YAML_PATH)
assert not os.path.isfile(SECRET_PATH)
assert not os.path.isfile(VERSION_PATH)
assert not os.path.isfile(AUTOMATIONS_PATH)
await config_util.async_create_default_config(hass)
assert os.path.isfile(YAML_PATH)
@ -91,6 +99,7 @@ async def test_ensure_config_exists_creates_config(hass):
If not creates a new config file.
"""
assert not os.path.isfile(YAML_PATH)
with patch("builtins.print") as mock_print:
await config_util.async_ensure_config_exists(hass)

View File

@ -9,8 +9,11 @@ DEFAULT_TIME_ZONE = dt_util.DEFAULT_TIME_ZONE
TEST_TIME_ZONE = "America/Los_Angeles"
@pytest.fixture(autouse=True)
def teardown():
"""Stop everything that was started."""
yield
dt_util.set_default_time_zone(DEFAULT_TIME_ZONE)

View File

@ -26,14 +26,14 @@ TEST_BAD_SERIALIED = "THIS IS NOT JSON\n"
TMP_DIR = None
def setup():
"""Set up for tests."""
@pytest.fixture(autouse=True)
def setup_and_teardown():
"""Clean up after tests."""
global TMP_DIR
TMP_DIR = mkdtemp()
yield
def teardown():
"""Clean up after tests."""
for fname in os.listdir(TMP_DIR):
os.remove(os.path.join(TMP_DIR, fname))
os.rmdir(TMP_DIR)