Skip to content

Conversation

@shidesthewise
Copy link

Fix default args for py.test to be "tests" instead of using the
command name "test" also as the directory name to find tests.

command name "test" also as the directory name to find tests.
@pfmoore
Copy link
Member

pfmoore commented Aug 8, 2014

I'm somewhat baffled by this, as I thought py.test should discover the tests directory automatically when run without arguments. It does when I run it from the command line.

I guess the problem is a setup.py test peculiarity so I'm going to say I'm fine with this change but I'd prefer someone with experience with the setuptools test command to review and commit it.

@Ivoz
Copy link

Ivoz commented Aug 9, 2014

Will do when I get myself back on nix

@shidesthewise
Copy link
Author

I think I had tracked it down to a _pytest/config.py, _preparseconfig. Someone better versed in this area should definitely double-check my assumptions on how this was working.

def _prepareconfig(args=None, plugins=None):
    if args is None:
        args = sys.argv[1:]

sys.argv[1:] == ['test'] when going through setup.py test

@Ivoz
Copy link

Ivoz commented Aug 12, 2014

Hmm, then perhaps this is an issue with pytest's example, pytest_args should be set to [], not None.

@shidesthewise
Copy link
Author

I was wondering what the likelihood of these being adopted and merged into the mainline.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See http://pytest.org/latest/goodpractises.html#integration-with-setuptools-test-commands - should this not be self.pytest_args = []?

Having said this, the tests for virtualenv are a bit of a mess and don't really follow the py.test standard discovery rules - see http://pytest.org/latest/goodpractises.html#test-discovery

I'd rather we fixed up the tests properly instead of hard-coding a tests directory that could cause us grief later...

@dstufft dstufft mentioned this pull request Jan 5, 2015
5 tasks
@shidesthewise
Copy link
Author

Because this is old and based on 1.11 and virtualenv is now in a 13.X series, I'll re-submit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants