Skip to content

Commit

Permalink
TestCase : Ensure temp directory can be deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Jan 9, 2025
1 parent 49ecfd8 commit 77d4969
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions python/GafferTest/TestCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def tearDown( self ) :
IECore.RefCounted.collectGarbage()

if self.__temporaryDirectory is not None :
if os.name == "nt" :
subprocess.check_call( [ "icacls", self.temporaryDirectory(), "/grant", "Users:(OI)(CI)(W)" ] )

for root, dirs, files in os.walk( self.temporaryDirectory() ) :
for fileName in [ p for p in files + dirs if not ( pathlib.Path( root ) / p ).is_symlink() ] :
( pathlib.Path( root ) / fileName ).chmod( stat.S_IRWXU )
Expand Down
3 changes: 0 additions & 3 deletions python/GafferUSDTest/USDLayerWriterTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,5 @@ def testNoWritePermissions( self ) :
with self.assertRaisesRegex( RuntimeError, 'Failed to export layer to "{}"'.format( layerWriter["fileName"].getValue() ) ) :
layerWriter["task"].execute()

if os.name == "nt" :
subprocess.check_call( [ "icacls", self.temporaryDirectory(), "/grant", "Users:(OI)(CI)(W)" ] )

if __name__ == "__main__":
unittest.main()

0 comments on commit 77d4969

Please sign in to comment.