How do I run a single test with Nose in Pylons

后端 未结 6 1331
星月不相逢
星月不相逢 2021-01-29 23:09

I have a Pylons 1.0 app with a bunch of tests in the test/functional directory. I\'m getting weird test results and I want to just run a single test. The nose documentation say

6条回答
  •  悲哀的现实
    2021-01-30 00:02

    I wrote this small script, based on the previous answers:

    #!/usr/bin/env bash
    
    # 
    # Usage:
    # 
    #     ./noseTest  
    # 
    # e.g.:
    # 
    #     ./noseTest test/MainTest.py mergeAll
    #     
    # It is assumed that the file and the test class have the _same name_ 
    # (e.g. the test class `MainTest` is defined in the file `MainTest.py`).
    # If you don't follow this convention, this script won't work for you.
    #
    
    testFile="$1"
    testMethod="$2"
    
    testClass="$(basename "$testFile" .py)"
    
    nosetests "$testFile:$testClass.test_$testMethod"
    

提交回复
热议问题