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

Split tests into individual test cases #67

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

sbrugman
Copy link
Collaborator

@sbrugman sbrugman commented Aug 19, 2024

metafunc.parametrize can be used to create more granular test cases by dynamically generating test fixtures (i.e. arguments). This in our case is helpful for debugging failing test cases, by knowing directly which of the paths are failing.

Before

After

Changes:

  • Split checker and codemod tests into individual test cases via metafunc
  • Few pathlib cleanups
  • Removed obviated logger calls in these functions

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 19, 2024
@sbrugman sbrugman force-pushed the individual-test-cases branch 5 times, most recently from fb945ae to 7677b9a Compare August 19, 2024 10:42
@sbrugman sbrugman changed the title Split checker and codemod tests into individual test cases Split tests into individual test cases Aug 19, 2024
@sbrugman sbrugman force-pushed the individual-test-cases branch from 7677b9a to b99c016 Compare August 19, 2024 10:44
@sbrugman
Copy link
Collaborator Author

Resolved merge conflict. I'll start adding some lint rules once this one it merged.

@sbrugman sbrugman force-pushed the individual-test-cases branch from d4845d7 to 955670b Compare September 3, 2024 07:21
@sbrugman
Copy link
Collaborator Author

sbrugman commented Sep 4, 2024

@kit1980 Any objections merging this? Generation of tests with metafunc is coming staight from the pytest docs and seems to be the idiomatic way of doing so.

@kit1980
Copy link
Contributor

kit1980 commented Sep 10, 2024

Looks good to me, thanks! Please resolve conflicts before merging.

@sbrugman sbrugman merged commit 5699fc8 into pytorch-labs:main Sep 10, 2024
3 checks passed
@sbrugman sbrugman deleted the individual-test-cases branch September 10, 2024 12:09
sbrugman added a commit that referenced this pull request Sep 12, 2024
This PR updates the test fixtures to have the `.py` extension for
codemod output files. This is helpful for writing new tests (I'll be
adding some for the new rules)

- Codemod output is now stored as `.out.py` instead of `.py.out`. This
marks the files as Python source to IDEs, linters etc. For test
discovery, the input files were renamed to `.in.py` from `.py`.

Follow-up PR for #67. Will
rebase this one once that PR is merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants