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

Switch to native pytest in tests/utils #1387

Merged
merged 3 commits into from
Nov 22, 2021

Conversation

pquentin
Copy link
Member

There are two different commits, which should help with the review.

@pquentin pquentin added :misc Changes that don't affect users directly: linter fixes, test improvements, etc. cleanup Linter changes, reformatting, removal of unused code etc. labels Nov 19, 2021
@pquentin pquentin added this to the 2.3.1 milestone Nov 19, 2021
@pquentin pquentin self-assigned this Nov 19, 2021
Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

I left two minor comments. Please feel free to address them but no need for another review round in any case. LGTM

convert.to_bool(value)
self.assertEqual("Cannot convert [%s] to bool." % value, ctx.exception.args[0])
assert "Cannot convert [%s] to bool." % value == ctx.exception.args[0]
Copy link
Member

Choose a reason for hiding this comment

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

We could also switch to f-strings here?

Copy link
Member Author

Choose a reason for hiding this comment

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

My intention is to this with pyupgrade at some point. Fixed here, though!

self.assertEqual(os.path.expanduser("~"), io.normalize_path("~/Documents/.."))
assert io.normalize_path("/already/a/normalized/path") == "/already/a/normalized/path"
assert io.normalize_path("/not/normalized/path/../") == "/not/normalized"
assert os.path.expanduser("~") == io.normalize_path("~/Documents/..")
Copy link
Member

Choose a reason for hiding this comment

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

Should we reverse the order here so the call to io.normalize_path comes first? Then this is consistent with the other assertions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch, thanks

@pquentin pquentin merged commit 57475be into elastic:master Nov 22, 2021
@pquentin pquentin deleted the test-utils-pytest branch November 22, 2021 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Linter changes, reformatting, removal of unused code etc. :misc Changes that don't affect users directly: linter fixes, test improvements, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants