2014-05-23 49 views
0

我嘗試在Ubuntu上運行一系列測試用例,並且沒有從一個文件夾收集我的測試用例。我使用unittest編寫測試用例。Ubuntu上的py.test

在Windows上我使用這個命令:

py.test –v "folder with test cases" > log_file.txt 

從Windows輸出:

============================= test session starts ============================= 
platform win32 -- Python 2.6.3 -- py-1.4.20 -- pytest-2.5.2 -- C:\Python26\python.exe 
plugins: capturelog 
collecting ... collected 27 items 

在Ubuntu相同的命令,輸出是:

============================= test session starts ============================== 
platform linux2 -- Python 2.7.3 -- pytest-1.3.4 
test path 1: TestScenario01/ 

=============================== in 0.01 seconds =============================== 

我用不同的Python版本,因爲在Windows上Scapy僅適用於Python 2.6。另一個區別是,在Windows上出現py-1.4.20和pytest-2.5.2。我也將它們安裝在Ubuntu上。

+0

您的測試用例是否帶有'test_'前綴? –

+0

它們是'testTS0x'。我有setup.cfg:'python_files = *。py python_classes = TS * python_functions = test *' – user2399087

+0

右鍵檢查http://pytest.org/latest/goodpractises.html#test-discovery只是爲了確保 –

回答

0

我設法開始測試。我不得不刪除舊的py-1.3.4模塊並安裝py-1.4.2,並且還必須將pytest升級到2.5.2版本。現在它可以工作。