2012-11-14 129 views
1

我已經安裝了許多python模塊到一個普通的Linux目錄中,許多人將通過NFS掛載使用(是的,我知道這是一個與python性能打擊)我有能夠以擁有NFS掛載的用戶以及root身份運行scipy.test('full')。蟒蛇scipy單元測試

有沒有一種方法可以將參數傳遞給scipy.test()函數,該函數將告知它在哪些目錄中構建sc_ *和linux227compiled_catalog.d *文件?即scpipt.test('full',/ tmp),以便任何安裝此用戶的用戶都可以運行這些測試並且不具有對NFS掛載的寫入權限?

在此先感謝。

回答

0

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)