Search code examples
pythonpyqtnosenosetests

Can't run individual nosetests from a PyQt GUI I've made - ValueError: No such test


I've created a GUI for running nosetests in PyQt.

GUI code: http://pastebin.com/uVhkdDZc
My code: http://pastebin.com/3MG8PJn0

My interface reads the files in a folder of unittests and then populates a combobox with those tests and in turn, another combo box based on the tests it finds in the selected test file.

Based on these docs I thought I could run nosetests /path/to/test/file.py:test_function

However when I try to run a specific test within my unittest.py file I get a ValueError: No such test test_123

An example of the command that my interface generates is:
nosetests C:\path\to\my\unittest.py:test_123
And yet unittest.py contains def test_123():

So where am I going wrong? Do I need to add to my test? The setup/teardowns just currently pass


Solution

  • This should perhaps of been more obvious than I thought, but as always when I follow docs to set things up I overlook the basics.

    Because my tests are setup within a class the class needs to be referenced when calling a single test from within that class.

    So where I tried to call a test with
    nosetests C:\path\to\my\unittest.py:test_123

    I should have ran that in relation to it's class with
    nosetests C:\path\to\my\unittest.py:tests.test_123