1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Prefer __version__ over __VERSION__ internally, fallback when referencing modules

This commit is contained in:
Ross McFarland
2023-11-12 15:46:28 -08:00
parent 344bc2de5f
commit d2baf6db8f
2 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,7 @@ from helpers import (
TemporaryDirectory,
)
from octodns import __VERSION__
from octodns import __version__
from octodns.idna import IdnaDict, idna_encode
from octodns.manager import (
MainThreadExecutor,
@ -746,13 +746,13 @@ class TestManager(TestCase):
manager = Manager(get_config_filename('simple.yaml'))
class DummyModule(object):
__VERSION__ = '2.3.4'
__version__ = '2.3.4'
dummy_module = DummyModule()
# use importlib.metadata.version
self.assertTrue(
__VERSION__,
__version__,
manager._try_version(
'octodns', module=dummy_module, version='1.2.3'
),

View File

@ -5,7 +5,7 @@
from unittest import TestCase
from unittest.mock import patch
from octodns import __VERSION__
from octodns import __version__
from octodns.processor.meta import MetaProcessor
from octodns.provider.plan import Plan
from octodns.record import Create, Record, Update
@ -67,7 +67,7 @@ class TestMetaProcessor(TestCase):
uuid_mock.side_effect = [Exception('not used')]
now_mock.side_effect = [Exception('not used')]
proc = MetaProcessor('test', include_time=False, include_version=True)
self.assertEqual([f'octodns-version={__VERSION__}'], proc.values)
self.assertEqual([f'octodns-version={__version__}'], proc.values)
# just provider
proc = MetaProcessor('test', include_time=False, include_provider=True)
@ -86,7 +86,7 @@ class TestMetaProcessor(TestCase):
)
self.assertEqual(
[
f'octodns-version={__VERSION__}',
f'octodns-version={__version__}',
'time=the-time',
'uuid=abcdef-1234567890',
],