From 89687553d14f3fb5be018ed945301dd8d163c506 Mon Sep 17 00:00:00 2001 From: Charles Langlois Date: Fri, 11 Aug 2023 15:36:05 -0400 Subject: [PATCH] service_discovery_service.tests.test_service_discovery_service.py: added type annotations, refactored new_template_file --- .../tests/test_service_discovery_service.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wazo_dird/plugins/service_discovery_service/tests/test_service_discovery_service.py b/wazo_dird/plugins/service_discovery_service/tests/test_service_discovery_service.py index 130a41131..aa9f34bf4 100644 --- a/wazo_dird/plugins/service_discovery_service/tests/test_service_discovery_service.py +++ b/wazo_dird/plugins/service_discovery_service/tests/test_service_discovery_service.py @@ -3,6 +3,7 @@ import os import tempfile +from typing import Any import unittest from hamcrest import assert_that, equal_to @@ -86,15 +87,14 @@ def test_that_the_service_looks_for_remote_servers_when_starting(self): def new_template_file(content): - f = tempfile.NamedTemporaryFile(delete=False) - with open(f.name, 'w') as f: + with tempfile.NamedTemporaryFile(mode='w', delete=False) as f: f.write(content) dir_, name = os.path.split(f.name) return f, dir_, name # TODO fix when the config will be generated by events -@unittest.skip +@unittest.skip('fix when the config will be generated by events') class TestSourceConfigGenerator(unittest.TestCase): def setUp(self): ( @@ -110,7 +110,7 @@ def tearDown(self): return def test_generate_with_an_unknown_service(self): - service_discovery_config = { + service_discovery_config: dict[str, Any] = { 'template_path': None, 'services': {}, 'hosts': { @@ -186,7 +186,7 @@ def test_generate_with_a_service(self): # TODO fix when the config will be generated by events -@unittest.skip +@unittest.skip("fix when the config will be generated by events") class TestProfileConfigUpdater(unittest.TestCase): def setUp(self): self.config = dict(CONFIG)