我想使用 py.test 测试函数的线程安全性我的努力:
def function_to_be_tested(arg1,arg2):
some functionality
class Test:
def setup()
def teardown()
def test_conc()
p1=Process(taget=function_to_be_tested,args(arg1,arg2,))
p2=Process (taget=function_to_be_tested,args(arg1,arg3,))
p1.start()
p2.start()
p1.join()
p2.join()
Run Code Online (Sandbox Code Playgroud)
使用 py.test 命令执行上面的文件。这显示以下错误。
ExceptionPexpect: isalive() encountered condition where "terminated" is 0, but there was no child process. Did someone else call waitpid() on our process?
Run Code Online (Sandbox Code Playgroud)
你能帮我解码这个错误,并就如何做到这一点提供指导吗?
谢谢这是我正在尝试的实际代码和堆栈跟踪:
import pytest
from multiprocessing import Process
from pexpect import pxssh
def func(cls,b):
cls.s.sendline("bteq")
cls.s.prompt()
print b
#some operations inside the bteq session
class Test:
@classmethod
def setup_class(cls):
cls.s=pxssh.pxssh()
cls.s.login("IP",'Username','Pwd')
@classmethod
def …Run Code Online (Sandbox Code Playgroud) python concurrency pytest python-multithreading python-multiprocessing
我正在尝试通过 cx_Oracle 模块连接到 Oracle 12c。使用以下代码登录可以在 cx_Oracle.connect 方法中未提及模式的情况下使用
import cx_Oracle
ip = 'ip'
port='1521'
SID='orcl'
dsn_tns = cx_Oracle.makedsn(ip, port, SID)
db = cx_Oracle.connect('system', 'password', dsn_tns)
Run Code Online (Sandbox Code Playgroud)
但对于以下方式,它显示 cx_Oracle.SYSDBA 模式的无效登录错误。
db = cx_Oracle.connect('system', 'password', dsn_tns, cx_Oracle.SYSDBA)
Run Code Online (Sandbox Code Playgroud)
错误:
cx_Oracle.DatabaseError: ORA-01017: invalid username/password; logon denied
Run Code Online (Sandbox Code Playgroud)
我在这里缺少什么?凭据是相同的。我尝试手动登录如下,成功
>sqlplus system/password as sysdba
Run Code Online (Sandbox Code Playgroud)