@@ -320,6 +320,7 @@ def testTagsLoadedAsCollections( self ):
320320 # includes
321321 fileName = os .path .join ( self .temporaryDirectory (), "testUSDTags.scc" )
322322 m = IECoreScene .SceneCache ( fileName , IECore .IndexedIO .OpenMode .Write )
323+ m .writeTags ( ["geoId:chessy" ] )
323324 t = m .createChild ( "t" )
324325 s = t .createChild ( "s" )
325326 t .writeTags ( ["t1" , "all" , "asset-(12)" ] )
@@ -330,6 +331,16 @@ def testTagsLoadedAsCollections( self ):
330331 stage = pxr .Usd .Stage .Open ( fileName )
331332 root = stage .GetPseudoRoot ()
332333
334+ tagInternalRootPrim = root .GetPrimAtPath ( f"/{ IECoreUSD .SceneCacheDataAlgo .internalRootName ()} " )
335+ self .assertEqual (
336+ tagInternalRootPrim .GetRelationship (
337+ "collection:{}:includes" .format (
338+ IECoreUSD .SceneCacheDataAlgo .toInternalName ( "geoId:chessy" )
339+ )
340+ ).GetTargets (),
341+ [ pxr .Sdf .Path ( f"/{ IECoreUSD .SceneCacheDataAlgo .internalRootName ()} " ) ]
342+ )
343+
333344 tagPrim = root .GetPrimAtPath ( "/{}/t" .format ( IECoreUSD .SceneCacheDataAlgo .internalRootName () ) )
334345 self .assertTrue ( tagPrim )
335346
@@ -346,6 +357,10 @@ def testTagsLoadedAsCollections( self ):
346357 stage .Export ( exportPath )
347358
348359 scene = IECoreScene .SharedSceneInterfaces .get ( exportPath )
360+ # check root tags
361+ self .assertTrue ( "geoId:chessy" in scene .readTags () )
362+
363+ # check children tags
349364 for tag , paths in tags .items ():
350365 for path in paths :
351366 child = scene .scene ( IECoreScene .SceneInterface .stringToPath ( path ) )
@@ -939,6 +954,17 @@ def testSceneWrite( self ):
939954 stage .Export ( exportPath )
940955 self .assertTrue ( os .path .exists ( exportPath ) )
941956
957+ # invalid path
958+ invalidExportPath = os .path .join ( self .temporaryDirectory (), "invalid" , "invalid.scc" )
959+ with IECore .CapturingMessageHandler () as mh :
960+ stage .Export ( invalidExportPath )
961+
962+ self .assertEqual ( len ( mh .messages ), 2 )
963+ self .assertEqual ( mh .messages [0 ].level , IECore .Msg .Level .Error )
964+ self .assertEqual ( mh .messages [0 ].context , "SdfFileFormatSharedSceneWriters::SceneLRUCache" )
965+ self .assertEqual ( mh .messages [1 ].level , IECore .Msg .Level .Error )
966+ self .assertEqual ( mh .messages [1 ].context , "UsdSceneCacheFileFormat::WriteToFile" )
967+
942968 # root
943969 layer = pxr .Sdf .Layer .FindOrOpen ( linkFileName )
944970
0 commit comments