From 0c666daf703e388fb160f4bbd913a324686788fb Mon Sep 17 00:00:00 2001 From: Julien LE CLEACH Date: Sat, 20 Nov 2021 10:04:31 +0100 Subject: [PATCH] fix __file__ issue in python 3.8 tests --- supvisors/tests/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/supvisors/tests/base.py b/supvisors/tests/base.py index 571f7b9c..1fe4215e 100644 --- a/supvisors/tests/base.py +++ b/supvisors/tests/base.py @@ -19,6 +19,7 @@ import os import random +import supvisors from socket import gethostname from unittest.mock import Mock @@ -190,9 +191,8 @@ class DummyHttpContext: """ Simple HTTP context for web ui views. """ def __init__(self, template=None): - import supvisors - module_path = os.path.dirname(supvisors.__file__) - self.template = os.path.join(module_path, template) if template else None + supvisors_path = next(iter(supvisors.__path__), '.') + self.template = os.path.join(supvisors_path, template) if template else None self.supervisord = DummySupervisor() # create form and response self.form = {'SERVER_URL': 'http://10.0.0.1:7777',