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

Extract formatting tests #1785

Merged
merged 5 commits into from
Oct 30, 2020
Merged

Conversation

saroad2
Copy link
Contributor

@saroad2 saroad2 commented Oct 25, 2020

A lot of the tests in Black are exact duplications of other tests.
In order to remove some of the duplications, added 2 parametrized tests that combine those tests.

pytest-cases >= 2.3.0
coverage >= 5.3
parameterized >= 0.7.4
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather then adding a new dependency, can @pytest.mark.parametrize be used to do the same thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can, but it has been requested specifically to avoid using pytest in tests directly in order to allow people to use the testing platform of their choosing.
I personally prefer using pytest at any time, but I respect the design decisions of this project.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My main pytest dislike is it's magical patching of thing so I guess the adding of a dep to allow both testing systems to be used works. Especially when this refactor is a big win imo.

@saroad2
Copy link
Contributor Author

saroad2 commented Oct 30, 2020

@cooperlees, any feedback on this?

Copy link
Collaborator

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

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

All looks like a good refactor to me. ~250 less lines and all makes sense! Thanks!

@cooperlees cooperlees merged commit e6cd10e into psf:master Oct 30, 2020
@saroad2 saroad2 deleted the extract_formatting_tests branch October 30, 2020 15:13
@ichard26 ichard26 mentioned this pull request Dec 25, 2020
3 tasks
noxan pushed a commit to noxan/black that referenced this pull request Jun 6, 2021
* Update test versions

* Use parametrize to remove tests duplications

* Extract sources format tests

* Fix mypy errors

* Fix .travis.yml
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.

3 participants