1212from test_common import cache_root , cores_root , library_root
1313
1414from fusesoc .config import Config
15+ from fusesoc .fusesoc import Fusesoc
16+ from fusesoc .librarymanager import Library
1517
1618build_root = "test_build_root"
1719
3234
3335
3436def test_library_location ():
35- from fusesoc .main import _get_core , init_coremanager
3637
3738 with tempfile .NamedTemporaryFile (mode = "w+" ) as tcf :
3839 tcf .write (
@@ -50,10 +51,10 @@ def test_library_location():
5051
5152 conf = Config (tcf .name )
5253
53- cm = init_coremanager (conf , [] )
54+ fs = Fusesoc (conf )
5455
55- _get_core ( cm , "mor1kx-generic" )
56- _get_core ( cm , "atlys" )
56+ fs . get_core ( "mor1kx-generic" )
57+ fs . get_core ( "atlys" )
5758
5859
5960def test_library_add (caplog ):
@@ -155,7 +156,6 @@ def test_library_add(caplog):
155156
156157
157158def test_library_update (caplog ):
158- from fusesoc .main import init_coremanager , init_logging , update
159159
160160 clone_target = tempfile .mkdtemp ()
161161
@@ -179,34 +179,28 @@ def test_library_update(caplog):
179179
180180 args = Namespace ()
181181
182- init_logging (False , False )
183- cm = init_coremanager (conf , [])
184-
185- # TODO find a better way to set up these defaults
186- args .libraries = []
182+ Fusesoc .init_logging (False , False )
183+ fs = Fusesoc (conf )
187184
188185 with caplog .at_level (logging .INFO ):
189- update ( cm , args )
186+ fs . update_libraries ([] )
190187
191188 assert "test_lib : auto-sync disabled. Ignoring update" in caplog .text
192189
193190 caplog .clear ()
194191
195- args .libraries = ["test_lib" ]
196-
197192 with caplog .at_level (logging .INFO ):
198- update ( cm , args )
193+ fs . update_libraries ([ "test_lib" ] )
199194
200195 assert "test_lib : Updating..." in caplog .text
201196
202197 caplog .clear ()
203198
204- args .libraries = []
205- _library = cm ._lm .get_library ("test_lib" )
199+ _library = fs .get_library ("test_lib" )
206200 _library .auto_sync = True
207201
208202 with caplog .at_level (logging .INFO ):
209- update ( cm , args )
203+ fs . update_libraries ([] )
210204
211205 assert "test_lib : Updating..." in caplog .text
212206
@@ -216,9 +210,7 @@ def test_library_update(caplog):
216210
217211 _library .sync_type = "local"
218212
219- args .libraries = []
220-
221213 with caplog .at_level (logging .INFO ):
222- update ( cm , args )
214+ fs . update_libraries ([] )
223215
224216 assert "test_lib : sync-type is local. Ignoring update" in caplog .text
0 commit comments