python scipy单元

2024-03-28 21:51:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经在一个普通的Linux目录中安装了许多python模块,许多人将通过NFS挂载来使用这个目录(是的,我知道这个使用python的esp有性能问题),我已经能够运行化学试验('full')作为拥有NFS装载和root的用户。在

有没有一种方法可以把论点传递给化学试验()函数,它将告诉它在哪个目录中生成sc_x*和linux227编译的\u catalog.d*文件?ie公司scpipt.试验('full',/tmp)以便装载此文件的任何用户都可以运行这些测试,并且对NFS装载没有写访问权限?在

提前谢谢。在


Tags: 模块文件方法函数用户目录linuxroot
1条回答
网友
1楼 · 发布于 2024-03-28 21:51:19

nvm。。。我在测试脚本中加入了以下内容:

import scipy
import os
import shutil

directory = os.getcwd()

userHomeDirectory = ( "/home/" + os.getlogin())
userHomeScipyTests = ( userHomeDirectory + "/scipytests" )

#               print ("your current directory location is: " + directory)
print ("Making the following temp folder:  " + userHomeScipyTests )
if (os.path.isdir(userHomeScipyTests)):
        shutil.rmtree(userHomeScipyTests)

os.makedirs ( userHomeScipyTests )
os.chdir( userHomeScipyTests )
print os.getcwd()
output = scipy.test('full')
#               print ("this is the output of the scipy full test: " + str(output.wasSuccessful()))
self.assertEqual(str(output.wasSuccessful()), 'True', 'FullSciPyTest failed')
if (output.wasSuccessful):
print ("Removing the following temp folder: " + userHomeScipyTests )
    shutil.rmtree(userHomeScipyTests)

相关问题 更多 >