Skip to content

Added kselect option to test runner - #2833

Closed
eteq wants to merge 1 commit into
astropy:masterfrom
eteq:add-k-to-test-runner
Closed

eteq wants to merge 1 commit into
astropy:masterfrom
eteq:add-k-to-test-runner

Conversation

@eteq

@eteq eteq commented Aug 7, 2014

Copy link
Copy Markdown
Member

I got tired of constantly doing python setup.py test --args="-k <something>" to select particular tests by name, so this adds a command to the astropy test runner that does this directly (without needing to go through args)

@eteq

eteq commented Aug 7, 2014

Copy link
Copy Markdown
Member Author

The companion to update the test command is astropy/astropy-helpers#72

Comment thread astropy/__init__.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Surely we could come up with a better name as well as doc for this. As long as we're defining our own interface why call it "k-anything"? I had to look up what py.test -k means.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I was thinking the explicit reference to k is good because that's what py.test calls it, so if you want to look up the syntax (which can be pretty convoluted if you want it to be), you need to know what to look up in the py.test docs. So I was trying to be minimal to redirect interested parties to the docs for -k instead of putting much detail here.

But none of that is a strong opinion - as long as the help clearly says something like "look up more details by looking up the py.test -k option", then I agree the name can be pretty much anything. Do you have a suggestion in mind, @embray? Maybe -s and --select-test or something like that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would actually vote for sticking with the py.test options otherwise it's going to get confusing. -s is already used for something else in pytest (show stdout) and if we decided to make that available at the top level, we could no longer use -s. We've been consistent so far, so I don't see a reason to change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

-k is fine for the short name. In principle we don't even need a long name, but if we had one I'd just say --test-name or something like that. The point is that it matches the test name against a pattern.

@eteq

eteq commented Sep 15, 2014

Copy link
Copy Markdown
Member Author

@astrofrog - just so we're clear, are you saying in the last comment that you think this shouldn't be done at all? That is, we should just leave the interface as-is? Part of my motivations is the comment "I had to look up what py.test -k means." - I think that's a little-known feature of py.test, but it's immensely useful as we get more-and-more tests.

But I'm not strongly attached to this, so if you are quite against it, then we can just close this (and astropy/astropy-helpers#72 )

@embray

embray commented Sep 15, 2014

Copy link
Copy Markdown
Member

I'd be fine with adding support for -k. I just wanted a different name for the long option name. What about just --match?

@astrofrog

Copy link
Copy Markdown
Member

@eteq - sorry for dropping the ball on this. I think we should implement this but I'm suggesting we keep the naming consistent with py.test so I'm +1 on -k over e.g. --match

@eteq

eteq commented Oct 16, 2014

Copy link
Copy Markdown
Member Author

Hmm, good point, @astrofrog. Maybe some other opinions? @mdboom @mhvk @keflavich (people I have vague memories of maybe seeing --k used...)? The question is if -k should be impelemend as to --match or something like that vs just -k in python setup.py test.

@eteq

eteq commented Oct 5, 2015

Copy link
Copy Markdown
Member Author

Note (mostly to myself unless someone else decided to do this) that this probably needs a major overhaul following #4020 .

@embray

embray commented Oct 5, 2015

Copy link
Copy Markdown
Member

Just a bit of shuffling around really. I can even do it if you want.

@eteq

eteq commented Dec 2, 2016

Copy link
Copy Markdown
Member Author

I'm just going to close this as it would be better to start afresh at this point anyway, whether or not this is worth doing.

@eteq eteq closed this Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants