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

improve test id for consistency tests #6763

Merged
merged 2 commits into from
Oct 13, 2022
Merged

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Oct 13, 2022

As requested by @vfdev-5 offline. In the past the ArgsKwargs object implemented a __repr__ method, so the old id made sense at the time.

@@ -575,9 +575,11 @@ def check_call_consistency(prototype_transform, legacy_transform, images=None, s
@pytest.mark.parametrize(
("config", "args_kwargs"),
[
pytest.param(config, args_kwargs, id=f"{config.legacy_cls.__name__}({args_kwargs})")
pytest.param(
config, args_kwargs, id=f"{config.legacy_cls.__name__}-{idx:0{len(str(len(config.args_kwargs)))}d}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The numerical id looks weird, but this actually makes sense. As implemented, we always get a zero-padded number depending on the number of runs. For example, test_call_consistency[RandomCrop-00] vs. test_call_consistency[RandomCrop-0]. Although this seems minor, without this, it is impossible to select the 0th test with -k 0 while at the same time pulling in test_call_consistency[RandomCrop-10] or any other test that also includes a 0 in its id. With this change you can do -k00 to select only the one test you want.

Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

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

Thanks!

@pmeier pmeier merged commit dc5fd83 into pytorch:main Oct 13, 2022
facebook-github-bot pushed a commit that referenced this pull request Oct 17, 2022
Reviewed By: NicolasHug

Differential Revision: D40427475

fbshipit-source-id: 209a4b7af54d80fbaf0ca4bc7e1a91bea6f028a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants