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

Add unit test for black formatting #261

Merged
merged 4 commits into from
Oct 10, 2018
Merged

Add unit test for black formatting #261

merged 4 commits into from
Oct 10, 2018

Conversation

jlowin
Copy link
Member

@jlowin jlowin commented Oct 10, 2018

Closes #259.

@jlowin jlowin requested a review from cicdw as a code owner October 10, 2018 17:45
@jlowin jlowin added the testing Related to testing workflows label Oct 10, 2018
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Black requires Python 3.6+")
def test_black_formatting():
# make sure we're in the right place
assert __file__.endswith("/tests/test_formatting.py")
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why this assert is necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was worried that this file might get moved inadvertently, without someone necessarily looking at it (for example if the tests directory were restructured), and causing the following line (that runs black against the root) to fail. If there's a way to always get the repo root, I'd use that instead, but I'm not sure how.

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok that makes sense, otherwise you might accidentally black check a larger directory or something 👍

@cicdw cicdw merged commit 707174b into master Oct 10, 2018
@cicdw cicdw deleted the black branch October 10, 2018 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Related to testing workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants