wbolster / emacs-python-pytest

run pytest inside emacs
BSD 3-Clause "New" or "Revised" License
147 stars 25 forks source link

Projectile test file filtering #38

Closed RJTK closed 2 years ago

RJTK commented 3 years ago

The documentation surrounding the use of projectile to filter test files could be improved. My test directory wasn't recognized by projectile and therefore the projectile-test-files function used in python-pytest--select-test-files was filtering out everything and I just got "No test files found" messages without further explanation.

Possibly have a configuration variable that allows turning off the projectile-test-files filtering, or just add a blurb about ensuring projectile's test-dir is properly set in the docs or the error message.

wbolster commented 3 years ago

hmmm, never experienced this myself, but i see how this can be confusing.

would it be enough to silently fallback to listing all project files in case projectile-test-files doesn't yield anything?

RJTK commented 3 years ago

That's probably adequate, though wouldn't help the user find the actual problem.

wbolster commented 3 years ago

🤔

showing an error and pointing to a (currently nonexisting) config flag isn't really helping either, i think?

and a global config flag is also not really helping, since it affects all projects, not just the one that doesn't have a working projectile-test-files for some reason. (and it adds complexity.)

not sure if it's possible to show a warning somehow. messages would usually appear at the bottom of the screen, but the whole interaction here involves reading from the minibuffers, which also puts stuff at the bottom of the screen... 😐

RJTK commented 3 years ago

It's indeed probably best to keep it simple -- I'd probably just add a sentence to the documentation. e.g. where it says "note that python-pytest.el uses projectile for some of its features, e.g. finding associated test files. this package is intended to work correctly even without any projectile configuration, since it will likely do the right thing if a project has a conventional layout."

Could be e.g. "note that python-pytest.el uses projectile for some features, e.g. locating test files according to projectile-test-files. This package is intended to work correctly even without any projectile configuration and will likely do the right thing if a project has a conventional layout. However, an incorrectly configured projectile will likely break python-pytest.el functionality."

wbolster commented 2 years ago

i've changed the behaviour of python-pytest-files to show test files if any were found, and if not, show all files instead.