Problem: A script tool using arcpy.TestSchemaLock does not return the correct value when the tool is run in 64-bit background geoprocessing
TestSchemaLock returns True (1) when the actual value is False (0) when the script tool is run from 64-bit background geoprocessing.
This is a known limitation. The 64-bit background processing cannot gather the schema lock information across applications running as 32-bit. Therefore, script tools using TestSchemaLock run in 64-bit background geoprocessing are unable to check/test the data for locks in ArcMap/ArcCatalog and other 32-bit applications. Thus, any use of TestSchemaLock in this scenario appears as if the data is not locked.
However, if attempting to do something like modify data being edited (say by append or an updatecursor), this is prevented due to higher framework checks performed by ArcGIS itself to make sure the data can be used. ArcGIS is still able to prevent the use of data that is locked. Just the TestSchemaLock function in scripts run from 64-bit background geoprocessing cannot report that this lock information is present on the data that is used across the different bit versions.
Solution or Workaround
In the script tool properties dialog, select 'Always run in foreground'.