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 the partial flag #117

Merged
merged 1 commit into from
Oct 25, 2017
Merged

Deprecate the partial flag #117

merged 1 commit into from
Oct 25, 2017

Conversation

mtreinish
Copy link
Owner

The partial flag is vestigial and left over from the original testr fork.
It was originally used to indicate a run did not execute the entire test
suite. However this doesn't really come into play anywhere else and
it's not stored in the repository either. I think the eventual intent
was to treat those records as incomplete for other purposes but that
never really was implemented. With the introduction of load to run-id
and also a run --combine this isn't really needed anymore either. It's not
really something that should be user facing either. The user shouldn't
have to tell the runner whether the run is the full suite or not.

This commit removes the functional bits from the cli (and their python
api commands) and deprecates all the flags for partial. The repository
partial usage remains intact because it's coupled to how the file
repository runs. (it uses a memory repository with partial=True before
writing it to disk) So more care is needed before we rip that out, but
in the mean time this removes and deprecates all the end user facing
pieces.

Closes issue #108

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 62.292% when pulling 11de57e on deprecate-partial into 27a9ae2 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 62.292% when pulling 5ece957 on deprecate-partial into 24600a8 on master.

@mtreinish
Copy link
Owner Author

ooh, nice a .006% coverage increase :p

Copy link
Collaborator

@masayukig masayukig left a comment

Choose a reason for hiding this comment

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

LGTM, but I noticed one tiny thing about the help message.
And it seems like the DeprecationWarning is ignored by default[1]. So, I actually don't see the warnings.warn() message in my env. Is this your intention?

[1] https://docs.python.org/2/library/warnings.html#default-warning-filters

help="DEPRECATED: Only some tests will be run. Implied"
" by --failing. This option is deprecated and no "
"longer does anything. It will be removed in the"
"future")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you want to add a white space before future?

Copy link
Owner Author

Choose a reason for hiding this comment

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

oh, good catch. I'll respin this in a bit

@mtreinish
Copy link
Owner Author

Yeah, I saw the same thing in the docs and was debating on that, I'm not sure which is better. This is a warning for deprecation, and I don't necessarily want to spam people with it. But I do want it to be discoverable which this isn't. What do you think?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 62.292% when pulling b531108 on deprecate-partial into 24600a8 on master.

Copy link
Collaborator

@masayukig masayukig left a comment

Choose a reason for hiding this comment

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

Thanks, lgtm. I'm fine with that. I think --partial flag is used very rare.
I was just wondering what is the purpose of this warnings.warn() if people don't see the warnings.

@mtreinish
Copy link
Owner Author

Heh, well I was asking your opinion there. I don't actually know what is best here, I just read the warning module docs and that seemed to be what we wanted, because this is a deprecation. But, it might not be best. Maybe it's better to just not set a warning type and use the default so it'll be printed. I don't feel strongly either way.

Yeah, --partial shouldn't ever really be used it didn't really do anything so either way it's fine. It's more about signaling our users that the flag is going away so they'll need to update their usage.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 62.292% when pulling cae2b16 on deprecate-partial into c1660fa on master.

@masayukig
Copy link
Collaborator

I actually expected the warnings would be printed. But, I think we need to write a bit more code to print them. I don't think it's worth doing that.

@mtreinish
Copy link
Owner Author

Well I think it's the warning class there. On py3 I know they print regular warnings by default. I can switch it to a print too. Let me test some things locally and figure out the best compromise here

@mtreinish
Copy link
Owner Author

ok, I just removed the deprecation warning class type from the warn() call. In my local testing it prints once to stdout when you use the --partial flag. Granted it's not the most clean, but that's because upstream python never thinks about the end user experience. Do you think I should just switch it to a print?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 62.292% when pulling aa2059c on deprecate-partial into b4c2707 on master.

Copy link
Collaborator

@masayukig masayukig 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 updating. LGTM.
I feel this is better than the original one from a user perspective. Or I was thinking to add a filter code like this.

warnings.simplefilter('default', category=DeprecationWarning)

But I feel this is just a simple one line, but I think it probably causes some side effects.. So, my opinion is that just removing the class(treat as a UserWarning) is enough here.

The white space is a bit weird but I think it shouldn't be a blocker of this patch. We can fix it with a following patch easily.

@@ -194,6 +199,9 @@ def run_command(config='.stestr.conf', repo_type='file',
for failures.
:rtype: int
"""
if partial:
warnings.warn('The partial flag is deprecated and has no effect '
Copy link
Collaborator

Choose a reason for hiding this comment

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

heh, there are two white spaces after the word 'effect'.

The partial flag is vestigial and left over from the original testr fork.
It was originally used to indicate a run did not execute the entire test
suite. However this doesn't really come into play anywhere else and
it's not stored in the repository either. I think the eventual intent
was to treat those records as incomplete for other purposes but that
never really was implemented. With the introduction of load to run-id
and also a run --combine this isn't really needed anymore either. It's not
really something that should be user facing either. The user shouldn't
have to tell the runner whether the run is the full suite or not.

This commit removes the functional bits from the cli (and their python
api commands) and deprecates all the flags for partial. The repository
partial usage remains intact because it's coupled to how the file
repository runs. (it uses a memory repository with partial=True before
writing it to disk) So more care is needed before we rip that out, but
in the mean time this removes and deprecates all the end user facing
pieces.

Closes issue #108
@mtreinish
Copy link
Owner Author

Ok, the latest rev quickly fixes the double space, I'll merge it after the CI jobs come back.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 62.292% when pulling dd11975 on deprecate-partial into b4c2707 on master.

@mtreinish mtreinish merged commit ed588cd into master Oct 25, 2017
@mtreinish mtreinish deleted the deprecate-partial branch October 25, 2017 08:27
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.

None yet

3 participants