Browse Source

Prefer __version__ over __VERSION__ internally, fallback when referencing modules

pull/1101/head
Ross McFarland 2 years ago
parent
commit
d2baf6db8f
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
2 changed files with 6 additions and 6 deletions
  1. +3
    -3
      tests/test_octodns_manager.py
  2. +3
    -3
      tests/test_octodns_processor_meta.py

+ 3
- 3
tests/test_octodns_manager.py 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'
),


+ 3
- 3
tests/test_octodns_processor_meta.py 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',
],


Loading…
Cancel
Save