Skip to content

Extract formatting tests#1785

Merged
cooperlees merged 5 commits into
psf:masterfrom
saroad2:extract_formatting_tests
Oct 30, 2020
Merged

Extract formatting tests#1785
cooperlees merged 5 commits into
psf:masterfrom
saroad2:extract_formatting_tests

Conversation

@saroad2
Copy link
Copy Markdown
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.

Comment thread test_requirements.txt
pytest-mock >= 3.3.1
pytest-cases >= 2.3.0
coverage >= 5.3
parameterized >= 0.7.4 No newline at end of file
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

saroad2 commented Oct 30, 2020

@cooperlees, any feedback on this?

Copy link
Copy Markdown
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