@@ -37,6 +37,16 @@ def update_release(directory, name, version, agnos_version, release_notes):
37
37
os .symlink ("common/version.h" , test_symlink )
38
38
39
39
40
+ def get_version (path : str ) -> str :
41
+ with open (os .path .join (path , "common" , "version.h" )) as f :
42
+ return f .read ().split ('"' )[1 ]
43
+
44
+
45
+ def get_consistent_flag (path : str ) -> bool :
46
+ consistent_file = pathlib .Path (os .path .join (path , ".overlay_consistent" ))
47
+ return consistent_file .is_file ()
48
+
49
+
40
50
@pytest .mark .slow # TODO: can we test overlayfs in GHA?
41
51
class BaseUpdateTest (unittest .TestCase ):
42
52
@classmethod
@@ -109,11 +119,10 @@ def _test_params(self, branch, fetch_available, update_available):
109
119
self .assertEqual (self .params .get_bool ("UpdateAvailable" ), update_available )
110
120
111
121
def _test_finalized_update (self , branch , version , agnos_version , release_notes ):
112
- from openpilot .selfdrive .updated .common import get_version , get_consistent_flag # this needs to be inline because common uses environment variables
113
122
self .assertTrue (self .params .get ("UpdaterNewDescription" , encoding = "utf-8" ).startswith (f"{ version } / { branch } " ))
114
123
self .assertEqual (self .params .get ("UpdaterNewReleaseNotes" , encoding = "utf-8" ), f"<p>{ release_notes } </p>\n " )
115
124
self .assertEqual (get_version (str (self .staging_root / "finalized" )), version )
116
- self .assertEqual (get_consistent_flag (), True )
125
+ self .assertEqual (get_consistent_flag (str ( self . staging_root / "finalized" ) ), True )
117
126
118
127
with open (self .staging_root / "finalized" / "test_symlink" ) as f :
119
128
self .assertIn (version , f .read ())
0 commit comments