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

Deprecate repo_type parameter in get_repo_open and get_repo_initialise #321

Merged
merged 3 commits into from
Apr 13, 2022

Conversation

masayukig
Copy link
Collaborator

This commit deprecates repo_type parameter in get_repo_open and
get_repo_initialise functions. As we discussed in PR#318 [1], these
should be deprecated before 4.0.0 release.

[1] #318

This commit deprecates `repo_type` parameter in `get_repo_open` and
`get_repo_initialise` functions. As we discussed in PR#318 [1], these
should be deprecated before 4.0.0 release.

[1] mtreinish#318
@masayukig masayukig requested a review from mtreinish April 6, 2022 00:47
Copy link
Owner

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

Thanks for doing this, sorry for the slow turnaround on reviewing this. For the most part it looks good to me, but I think there is a find/replace typo issue on all the updated calls. Other than that I had a question inline about writing to stderr in addition to emitting a warning.

@@ -103,7 +103,7 @@ def failing(repo_url=None, list_tests=False, subunit=False,
for failures.
:rtype: int
"""
repo = util.get_repo_open('file', repo_url)
repo = util.get_repo_open(repo_url)
Copy link
Owner

Choose a reason for hiding this comment

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

I'm curious does this work as expected? Aren't we passing repo_url here as the value for the repo_type argument. I think we're probably not catching this in tests because we use the default None and nothing is triggering the deprecation warning. I think this should be:

Suggested change
repo = util.get_repo_open(repo_url)
repo = util.get_repo_open(repo_url=repo_url)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, yeah, my bad.

@@ -228,7 +228,7 @@ def history_list(repo_url=None, show_metadata=False,
else:
field_names = ('Run ID', 'Passed', 'Runtime', 'Date')
try:
repo = util.get_repo_open('file', repo_url)
repo = util.get_repo_open(repo_url)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
repo = util.get_repo_open(repo_url)
repo = util.get_repo_open(repo_url=repo_url)

@@ -285,7 +285,7 @@ def history_show(run_id, repo_url=None, subunit_out=False,
:rtype: int
"""
try:
repo = util.get_repo_open('file', repo_url)
repo = util.get_repo_open(repo_url)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
repo = util.get_repo_open(repo_url)
repo = util.get_repo_open(repo_url=repo_url)

@@ -352,7 +352,7 @@ def history_remove(run_id, repo_url=None, stdout=sys.stdout):
:rtype: int
"""
try:
repo = util.get_repo_open('file', repo_url)
repo = util.get_repo_open(repo_url)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
repo = util.get_repo_open(repo_url)
repo = util.get_repo_open(repo_url=repo_url)

@@ -43,7 +43,7 @@ def init(repo_url=None, stdout=sys.stdout):
:rtype: int
"""
try:
util.get_repo_initialise('file', repo_url)
util.get_repo_initialise(repo_url)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
util.get_repo_initialise(repo_url)
util.get_repo_initialise(repo_url=repo_url)

@@ -380,7 +380,7 @@ def run_command(config='.stestr.conf',
stdout.write(msg)
exit(1)
try:
repo = util.get_repo_initialise('file', repo_url)
repo = util.get_repo_initialise(repo_url)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
repo = util.get_repo_initialise(repo_url)
repo = util.get_repo_initialise(repo_url=repo_url)

@@ -634,7 +634,7 @@ def run_tests():
# the result from the repository because load() returns 0
# always on subunit output
if subunit_out:
repo = util.get_repo_open('file', repo_url)
repo = util.get_repo_open(repo_url)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
repo = util.get_repo_open(repo_url)
repo = util.get_repo_open(repo_url=repo_url)

@@ -79,7 +79,7 @@ def slowest(repo_url=None, show_all=False,
:rtype: int
"""

repo = util.get_repo_open('file', repo_url)
repo = util.get_repo_open(repo_url)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
repo = util.get_repo_open(repo_url)
repo = util.get_repo_open(repo_url=repo_url)

@@ -164,7 +164,7 @@ def group_callback(test_id, regex=re.compile(group_regex)):
else:
group_callback = None
# Handle the results repository
repository = util.get_repo_open('file', repo_url)
repository = util.get_repo_open(repo_url)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
repository = util.get_repo_open(repo_url)
repository = util.get_repo_open(repo_url=repo_url)

if repo_type is not None:
msg = ("WARNING: Specifying repository type is deprecated and will be "
"removed in future release.\n")
sys.stderr.write(msg)
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure we need to write the warning to stderr here. We were doing that for the CLI to make sure users saw the warning as the DeprecationWarning is normally not seen. But since the repo type argument no longer exists on the CLI this is only for python library interface users and I think relying on the warnings interface may be enough for them. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

well, yeah, indeed. I'll remove this one and get_repo_initilise()'s one, too.

masayukig and others added 2 commits April 13, 2022 08:22
This commit removes warning messages for the stderr because these interfaces are only for python library interface not for CLI. We don't need to show them to users.
This commit fixes to use the updated call correctly.
@masayukig
Copy link
Collaborator Author

@mtreinish Thank you very much for your review! I think it's ready for review now. Can you take a look at it again when you have the time?

Copy link
Owner

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the quick update

@mtreinish mtreinish merged commit 3b5803c into mtreinish:main Apr 13, 2022
@masayukig masayukig deleted the deprecate-repo_type branch April 13, 2022 00:35
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.

2 participants