pytest-dev / pytest-dev/pytest

Make --ignore flag work with --pyargs

Open
#3,287 5 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: collection type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

I just discovered the --pyargs option and it's very practical. However it does not seem to take into account the --ignore options.

Example,

$ pytest --doctest-modules  --pyargs setuptools
============================================ test session starts ============================================
platform linux -- Python 3.6.4, pytest-3.4.1, py-1.5.2, pluggy-0.6.0
rootdir: /home/rth, inifile:
plugins: profiling-1.2.11
collected 6 items                                                                                           

anaconda2/envs/testn-env/lib/python3.6/site-packages/setuptools/namespaces.py .                       [ 16%]
anaconda2/envs/testn-env/lib/python3.6/site-packages/setuptools/package_index.py .                    [ 33%]
anaconda2/envs/testn-env/lib/python3.6/site-packages/setuptools/sandbox.py .                          [ 50%]
anaconda2/envs/testn-env/lib/python3.6/site-packages/setuptools/command/develop.py .                  [ 66%]
anaconda2/envs/testn-env/lib/python3.6/site-packages/setuptools/command/install_lib.py .              [ 83%]
anaconda2/envs/testn-env/lib/python3.6/site-packages/setuptools/command/py36compat.py .               [100%]

========================================= 6 passed in 0.52 seconds ==========================================

running,

pytest --doctest-modules --ignore develop.py  --pyargs setuptools

produces exactly identical output, while I would have expected the develop.py not to be tested.
Here is another example of this same issue.

Is there a way around it?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented commands with pytest, --doctest-modules, --pyargs setuptools, and --ignore develop.py. Trace the collection paths for --pyargs and --ignore; done means the develop.py module is excluded while the other setuptools modules remain collected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.