Skip to content

Commit

Permalink
fix version hierarchy in readme
Browse files Browse the repository at this point in the history
and add a test, for good measure
  • Loading branch information
dennisvang committed Nov 30, 2023
1 parent f33cb38 commit ff8a60d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ If the app checks the alpha channel (`'a'`), it finds `2.0.0a3`.
Just to be clear: `tufup` assumes a typical linear release history without branching, so

```none
0.0 < 0.1a < 0.1b < 0.1rc < 0.1rc0 < 0.1rc1 < 0.1 < ...
0.0 < 0.1a < 0.1b < 0.1rc < 0.1rc1 < 0.1 < ...
```

## Migrating from other update frameworks
Expand Down
9 changes: 9 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import unittest
from unittest.mock import Mock, patch

import packaging.version
from requests.auth import HTTPBasicAuth
import tuf.api.exceptions
from tuf.ngclient import TargetFile
Expand Down Expand Up @@ -213,6 +214,14 @@ def test__apply_updates(self):
client._apply_updates(install=mock_install, skip_confirmation=True)
mock_install.assert_called()

def test_version_comparison(self):
# verify assumed version hierarchy
v = packaging.version.Version
self.assertTrue(
v('0.0.0') < v('0.1a') < v('0.1b') < v('0.1rc') < v('0.1rc1') < v('0.1')
)
self.assertEqual(v('0.1rc'), v('0.1rc0'))


class AuthRequestsFetcherTests(unittest.TestCase):
def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tufup.common import Patcher, TargetMeta


class TestTargetMeta(TempDirTestCase):
class TargetMetaTests(TempDirTestCase):
def test_init_whitespace(self):
for kwargs in [
dict(target_path='w h i t e s p a c e-1.2.3.tar.gz'),
Expand Down

0 comments on commit ff8a60d

Please sign in to comment.