Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line arguments don't work for pytester plugin #968

Closed
ionelmc opened this issue Aug 27, 2015 · 5 comments
Closed

Command line arguments don't work for pytester plugin #968

ionelmc opened this issue Aug 27, 2015 · 5 comments
Labels
type: enhancement new feature or API change, should be merged into features branch

Comments

@ionelmc
Copy link
Member

ionelmc commented Aug 27, 2015

Because it's not active by default arguments like --runpytest=subprocess are not recognized:

usage: py.test [options] [file_or_dir] [file_or_dir] [...]
py.test: error: unrecognized arguments: --runpytest=subprocess
  inifile: /home/ionel/osp/pytest-cov/setup.cfg
  rootdir: /home/ionel/osp/pytest-cov

Maybe the argument parsing for pytester should be moved in core?

@ionelmc ionelmc added the type: enhancement new feature or API change, should be merged into features branch label Aug 27, 2015
@nicoddemus
Copy link
Member

_pytester is not loaded by default because it is only useful for plugin authors. Besides the little import time cost, it would also appear in the list of plugins, so this might seem strange for the regular user. To workaround that you have to pass -p pytester in the command line (or in your pytest.ini).

(Based on your recent commits into pytest-cov I'm sure you are aware of that, but I'm writing this anyway for the benefit of those who don't have this background 😄 )

Just moving the options to the core wouldn't be enough, as something (still in core) would have to see that pytester-related options are set, and then load pytester... I'm not sure it is worth the hassle, specially because pytester is meant for plugin authors only. What do you think?

@ionelmc
Copy link
Member Author

ionelmc commented Aug 27, 2015

I don't want it that bad, using '-p' seems reasonable.

Though there's one additional problem, on 2.7 there's no --runpytest argument. I have to create this workaround in a conftest.py to make the tests run on 2.7:

def pytest_configure(config):
    config.option.runpytest = 'subprocess'

Would be worth to at least document this.

@nicoddemus
Copy link
Member

I think pytester itself deserves some documentation, including examples on how to write tests for plugins you write yourself.

We should open a new issue for it, and then of course --runpytest could be documented properly. What do you think?

@ionelmc
Copy link
Member Author

ionelmc commented Aug 27, 2015

I agree but I don't wanna do it, just slowly learning what in that plugin 😁

@nicoddemus
Copy link
Member

OK, created #971 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

2 participants