2017-04-27 48 views
0

我想嘗試圖形單元測試作爲正式documents做圖形單元測試時說:錯誤的Kivy應用

我有nose和安裝coverage。我輸入make test

但之後我得到一個錯誤:
make: *** No rule to make target 'test'. Stop.

如何解決這個問題,好嗎?

回答

0

使得命令應該從源文件夾的根文件夾運行。

基本上它只做:

test: 
    -rm -rf kivy/tests/build 
    $(NOSETESTS) kivy/tests 

你也可以使用此命令不通過的Makefile打算:

python -m nose.core your_project/your_tests 

關於渲染功能(R),我會複製部分文檔在這裏:

Each call to self.render (or r in our example) will generate an image named as follows: 

<classname>_<funcname>-<r-call-count>.png 
r-call-count represents the number of times that self.render is called inside the test function. 

The reference images are named: 

ref_<classname>_<funcname>-<r-call-count>.png 
You can easily replace the reference image with a new one if you wish. 
+0

嗨,感謝您的答案,似乎工作,但仍然以'0.000的測試0'結束,任何想法?我用你的'python -m nose.core my_test.py'方法。裏面的代碼來自kivy官方圖形測試文檔。我認爲混淆的部分是沒有斷言,只是r(),這個渲染函數在這裏聲明瞭什麼? –

+0

看來你在文件中沒有任何測試......反正** r **(* render *)會創建一個圖像文件,你可以保存這些文件並稍後使用它們進行比較 –

+0

謝謝,有點有點困惑,在調用r()之後發生了什麼?只是渲染一張圖片?我們需要通過我們的眼睛來檢查它是對還是錯?我跟着官方文檔,似乎他們只叫r()...我希望在這裏有一些比較方法。 –