spyder-ide / spyder-unittest

A plugin for Spyder to run tests and view the results
MIT License
79 stars 34 forks source link

Add option to restrict to tests in specific directory #125

Open RnoldR opened 5 years ago

RnoldR commented 5 years ago

Description of your problem

When I run the test I get the following errors (please implement a text copy command in unit testing pane): not run t.test_add_seq not run t.test_replace_seq failure p.test_base64_img_collection_error

The failure is caused by a test in a complete other file: pocs/test_base64_img.py The pocs directory is a directory in the current working directory. In the cwd the files music_utilities.py and test_music_utilities.py reside. It seems that spyder-unittest searches for all files in all directories from the cwd.

What steps will reproduce the problem?

This is the file test_music_utilities.py

from music_utilities import MusicFiles

Test the musicfiles class

def test_add_seq(): assert MusicFiles.seq_name('d.csv', 2) == 'd_0002.csv'

def test_replace_seq(): MusicFiles.seq_name('d_3.csv', 2) == 'd_0002.csv'

It is aimed at testing the file music_utilities.py

What is the expected output? What do you see instead?

True True

What I see instead is described in the problem description

Key versions and other information:

jitseniesen commented 4 years ago

This is how pytest works by default. It looks in all subdirectories for tests. Normally all tests are run, but certain errors (e.g. syntax errors) cause pytest to give up before running the tests. Without more information, it is impossible to know specifically what is happening in this case.

I think what is needed here is an option to run tests only in a specific directory, just like #88 asks for running a specific test, so that's how I'll interpret this issue.