Forum Discussion

Alecs's avatar
Alecs
Senior Member
6 years ago

TestComplete lock library files after first run

Hi,

I faced with problem when importing several librarys. On first test run everythins works as expected, but if I try to run agait the same routine without re-run testcomplete I get an error.

The problem is that library files was locked by testcomplete process on first run, and they was not released after test is finished.

Here my code:

 

sys.path.insert(0, Project.Path + '..\\Lib')
sys.path.insert(0, Project.Path + '..\\..\\')
from APItests import LogGenerator
import io
nism_ip = ProjectSuite.Variables.NismIP
falcon_ip = Project.Variables.MARipageURL.split('/')[2]

f = io.StringIO()
sys.stdout = f
sys.stderr = f

def clear_logs():
    """
    Clear all log events on falcon
    """
    LogGenerator.clear_logs(falcon_ip, nism_ip)
    print_stdout()

def print_stdout():
    """
    Function to print in Log.Message the 'print()' statement
    """
    output = f.getvalue().split('\n')
    for o in output:
        Log.Message(o)
    f.seek(0)
    f.truncate(0)

 

On first run of 'clear_logs()' routine it's passed, but  on second run there has error:

SystemError: initialization of _psycopg raised unreported exception	9:52:03	Normal			0.00
The script execution was interrupted.	9:52:03	Normal			0.18

TestComplete locks files for psycopg2 and for lxml librarys.

As workaround I found only one solution - rerun testcomplete

Anyone have sugestions how to fix these issue?