Skip to content

Commit

Permalink
Load files even with mismatching minor-version
Browse files Browse the repository at this point in the history
  • Loading branch information
exhuma committed Jul 2, 2020
1 parent c39720c commit 89dda6f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 7 deletions.
22 changes: 22 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
Release 4.3.8
-------------

Fixed
~~~~~

* Fixed a regression introduced in 4.3.7 which caused log-files no longer to be
loaded if ``meta.version`` had a mismatching minor-version


.. note::

While it may make sense to refuse loading config-version 1.2 when the app
asks for 1.4 (larger minor-version, same major-version), this would
introduce a backwards incompatibility and will break some apps using this.

This fix reverts that change from 4.3.7 but keeps the change on the test
deciding whether to log a warning or not, Before 4.3.7 we always emitted a
warning whenever the minor-version was *different*. Now we only emit one
when the minor version is too low in the loaded config-file.


Release 4.3.7
-------------

Expand Down
4 changes: 2 additions & 2 deletions config_resolver/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ def check_file(self, filename):
return False

if expected_minor > minor:
self._log.error(
self._log.warning(
'Mismatching minor version number in %r. '
'Expected %r, got %r!',
abspath(filename),
str(self.version),
file_version)
return False
return True
return True

def get(self, section, option, **kwargs): # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion config_resolver/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.7
4.3.8
22 changes: 22 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
Release 4.3.8
-------------

Fixed
~~~~~

* Fixed a regression introduced in 4.3.7 which caused log-files no longer to be
loaded if ``meta.version`` had a mismatching minor-version


.. note::

While it may make sense to refuse loading config-version 1.2 when the app
asks for 1.4 (larger minor-version, same major-version), this would
introduce a backwards incompatibility and will break some apps using this.

This fix reverts that change from 4.3.7 but keeps the change on the test
deciding whether to log a warning or not, Before 4.3.7 we always emitted a
warning whenever the minor-version was *different*. Now we only emit one
when the minor version is too low in the loaded config-file.


Release 4.3.7
-------------

Expand Down
8 changes: 4 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,15 @@ def test_mismatching_minor(self):
version='2.3')
self.catcher.assert_contains(
'config_resolver.hello.world',
logging.ERROR,
logging.WARNING,
'Mismatching minor version number')
self.catcher.assert_contains(
'config_resolver.hello.world',
logging.ERROR,
logging.WARNING,
'2.3')
self.catcher.assert_contains(
'config_resolver.hello.world',
logging.ERROR,
logging.WARNING,
'2.1')

def test_mixed_version_load(self):
Expand Down Expand Up @@ -473,7 +473,7 @@ def test_filename_in_log_minor(self):
version='2.3')
self.catcher.assert_contains_regex(
'config_resolver.hello.world',
logging.ERROR,
logging.WARNING,
'testdata/versioned/app.ini')

def test_filename_in_log_major(self):
Expand Down

0 comments on commit 89dda6f

Please sign in to comment.