|
3 | 3 |
|
4 | 4 | """Test ngclient Updater top-level metadata update workflow""" |
5 | 5 |
|
| 6 | +from __future__ import annotations |
| 7 | + |
6 | 8 | import builtins |
7 | 9 | import datetime |
8 | 10 | import os |
9 | 11 | import sys |
10 | 12 | import tempfile |
11 | 13 | import unittest |
12 | | -from collections.abc import Iterable |
13 | 14 | from datetime import timezone |
14 | | -from typing import Optional |
| 15 | +from typing import TYPE_CHECKING |
15 | 16 | from unittest.mock import MagicMock, call, patch |
16 | 17 |
|
17 | 18 | import freezegun |
|
37 | 38 | ) |
38 | 39 | from tuf.ngclient import Updater |
39 | 40 |
|
| 41 | +if TYPE_CHECKING: |
| 42 | + from collections.abc import Iterable |
| 43 | + |
40 | 44 |
|
41 | 45 | class TestRefresh(unittest.TestCase): |
42 | 46 | """Test update of top-level metadata following |
43 | 47 | 'Detailed client workflow' in the specification.""" |
44 | 48 |
|
45 | 49 | # set dump_dir to trigger repository state dumps |
46 | | - dump_dir: Optional[str] = None |
| 50 | + dump_dir: str | None = None |
47 | 51 |
|
48 | 52 | past_datetime = datetime.datetime.now(timezone.utc).replace( |
49 | 53 | microsecond=0 |
@@ -109,7 +113,7 @@ def _assert_files_exist(self, roles: Iterable[str]) -> None: |
109 | 113 | self.assertListEqual(sorted(found_files), sorted(expected_files)) |
110 | 114 |
|
111 | 115 | def _assert_content_equals( |
112 | | - self, role: str, version: Optional[int] = None |
| 116 | + self, role: str, version: int | None = None |
113 | 117 | ) -> None: |
114 | 118 | """Assert that local file content is the expected""" |
115 | 119 | expected_content = self.sim.fetch_metadata(role, version) |
|
0 commit comments