From 16df92a723800c7cde1fc79f4b08d17e29d6fac4 Mon Sep 17 00:00:00 2001 From: Bjarke Madsen <bjarke@nordu.net> Date: Thu, 27 Jul 2023 18:41:45 +0200 Subject: [PATCH] update broken test data filepaths --- test/conftest.py | 18 ++++++++---------- test/test_junos_devices_query.py | 5 +---- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index c95e25c6..1721bed6 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -14,11 +14,9 @@ import inventory_provider from inventory_provider.tasks import worker from inventory_provider import config -TEST_DATA_DIRNAME = os.path.realpath(os.path.join( - inventory_provider.__path__[0], - "..", - "test", - "data")) +TEST_DATA_DIRNAME = os.path.join( + os.path.dirname(__file__), + "data") _bootstrap_semaphore = threading.Semaphore() @@ -43,7 +41,7 @@ def data_config_filename(): "api": "ims_api", "username": "ims_username", "password": "ims_password" - }, + }, "managed-routers": "bogus url", "unmanaged-interfaces": [ { @@ -224,10 +222,10 @@ NETIFACES_TEST_DATA_STRING = """{ def mocked_netifaces(mocker): s = NETIFACES_TEST_DATA_STRING for k, v in { - 'AF_INET': netifaces.AF_INET, - 'AF_INET6': netifaces.AF_INET6, - 'AF_LINK': netifaces.AF_LINK - }.items(): + 'AF_INET': netifaces.AF_INET, + 'AF_INET6': netifaces.AF_INET6, + 'AF_LINK': netifaces.AF_LINK + }.items(): s = s.replace('{%s}' % k, str(v)) data = ast.literal_eval(s) mocker.patch('netifaces.interfaces', lambda: data.keys()) diff --git a/test/test_junos_devices_query.py b/test/test_junos_devices_query.py index c22657d9..b1ef7ee2 100644 --- a/test/test_junos_devices_query.py +++ b/test/test_junos_devices_query.py @@ -2,13 +2,10 @@ import os import responses -import inventory_provider from inventory_provider import juniper TEST_DATA_FILENAME = os.path.realpath(os.path.join( - inventory_provider.__path__[0], - '..', - 'test', + os.path.dirname(__file__), 'data', 'netdash-alldevices.txt')) -- GitLab