2011-06-13 15 views
19

Linux kabuğunda bir satır yazarak mevcut dizindeki tüm sınamaları çalıştırabilmem gerekir. Bazı dizinlerde, bu iyi çalışır. Ancak, diğerlerinde, "nosetest" yazdığımda hiçbir test çalıştırılmaz. Testler, onlar için ayrı ayrı çağırırsam çalışır, ancak hepsinin otomatik olarak çalıştırılmasına ihtiyacım var.Tüm Testleri Dizinde Kullanarak Burun Çalıştır

/extwebserver 
    __init__.py 
    test_Detection.py 
    test_Filesystem.py 
    test_Hardware.py 
    ... 

ben üst dizinde "nosetests" çalıştırdığınızda, çalışmakta olan belirli bir alt dizininde tüm testler ancak/extwebserver veya diğer alt dizinleri veya ebeveynden herhangi bir test: Burada işe yaramaz dizinlerden biridir dizinin kendisi çalıştırılır. Daniel Arbuckle tarafından Python Testing: Beginner's Guide itibaren

[email protected]:~/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing$ nosetests -vv --collect-only 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/baseTestCase.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/run.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Detection.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Filesystem.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Hardware.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Mode.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_System.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_View.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Webserver.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/mocks/bottle.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/utils/test_timestamps.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/testCamera.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/testCameraManager.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/testMainControllerServer.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/testMode.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/testPASEServerClient.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/testView.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/testViewsManager.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/test_commission/test_FSM.py is executable; skipped 
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/test_commission/test_Webserver.py is executable; skipped 
test_add (testing.utils.test_config.test_config) ... ok 
test_add_set (testing.utils.test_config.test_config) ... ok 
test_load (testing.utils.test_config.test_config) ... ok 
test_load_valid (testing.utils.test_config.test_config) ... ok 
test_modify_set (testing.utils.test_config.test_config) ... ok 
test_save (testing.utils.test_config.test_config) ... ok 
test_update (testing.utils.test_config.test_config) ... ok 
test_get_full_version (testing.utils.test_controller.test_controller) ... ok 
test_get_hwaddr (testing.utils.test_controller.test_controller) ... ok 
test_get_ip (testing.utils.test_controller.test_controller) ... ok 
test_get_netmask (testing.utils.test_controller.test_controller) ... ok 
test_get_version (testing.utils.test_controller.test_controller) ... ok 
test_FloatEncoder (testing.utils.test_fileio.test_fileio) ... ok 
test_read_file (testing.utils.test_fileio.test_fileio) ... ok 
test_read_json_string (testing.utils.test_fileio.test_fileio) ... ok 
test_system_to_text (testing.utils.test_fileio.test_fileio) ... ok 
test_write_file (testing.utils.test_fileio.test_fileio) ... ok 
test_get_hwaddr (testing.utils.test_netdev.test_netdev) ... ok 
test_get_ip (testing.utils.test_netdev.test_netdev) ... ok 
test_get_netmask (testing.utils.test_netdev.test_netdev) ... ok 
test_set_datetime (testing.utils.test_syncdatetime.test_syncdatetime) ... ok 
test_cast (testing.utils.test_tools.test_tools) ... ok 
test_get_image (testing.testdetection.test_CameraGuardian.test_CameraGuardian) ... ok 

---------------------------------------------------------------------- 
Ran 23 tests in 0.003s 
+0

@Matt: Çıktının "nosetests -vv --collect-only" biçiminden sağlanabilir, böylece burnun test keşif algoritmasından ayrıntılı bir çıktı görebiliriz? –

+0

Benzer bir sorun var ve skipediyorum, çünkü test çalıştırılabilir ..? – user2921139

cevap

45

:

Burun dizinleri testler ve isimleri test ve Test veya içermeyen ile başlayan modüllerin arar İşte DÜZENLEME

çıkışı var '_', '.' veya '- 've ardından test veya Test. Bu varsayılan, ama aslında tüm hikaye değil.

nosetests -vv --collect-only 

Ben Burun çalıştırılabilir dosyaları atlar fark, bir dizin yukarısında yayınlanmıştır Ne zaman:

An Extended Introduction to the nose Unit Testing Framework Eğer çalıştırarak burnun testi keşif algoritması bir ayrıntılı çıktı görebilirsiniz göstermektedir. Sorununuz buysa, dosya modunu yürütülebilir olmayan olarak değiştirmeniz gerekir. Mac OS X veya Linux'ta, bu aşağıdakilerle yapılabilir:

veya benzeri. Eğer modüller/dosyaları ithalat-güvende olduğunu biliyorsanız

, o zaman (erkek nosetests `dan) "çalıştırılabilir olan piton modüllerde testler için bak" --exe seçeneğiyle Burun çalıştırabilirsiniz:

nosetests --exe 
+0

Dizinleri yeniden adlandırmayı denedim, ancak yine de onlardan test almıyor. Form testi * ve test_ * denedim ve işe yaramadı. Ben de sadece --collect ile koştum ve çalıştırılabilir alt dizinden dosyaları listeledim ve böylece atlandı. Ama python.exe yolunu kaldırdım ve dosyalar hala yürütülebilir olarak listeleniyor. – Matt

+0

Dosya modunu, At'ın atladığı dosyalar için yürütülebilir olmayan olarak değiştirmeyi deneyin. –

+1

Chmod numarası işe yaradı.Artık tüm testler çalışma dizinini ve tüm alt dizinleri oluşturuyor. Yardım için teşekkürler! – Matt

11

Yürütülecek dosyaları geçerli sınamalar olarak dikkate almak üzere burnu zorlamak için komut satırında --exe'u kullanabilirsiniz. Eğer --exe her şey yazma yorgun alırsanız çizgi koyabilirsiniz: Bir .noserc içinde

= Doğru

exe ​​veya (pencereler için) nose.cfg dosyası (unix/linux için) yout ev dizini.

İlgili konular