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

verdi computer/code duplicate now reuses prepend_text and append_text #3788

Merged

Conversation

giovannipizzi
Copy link
Member

This required adding a new ContextualDefaultOption class
to get a default callable that also receives the context.
Moreover, a but was fixed in the function that prompts
for the prepend/append_text, as if the file was not touched/modified,
instead of reusing the text provided in input, an empty text was used instead.

Fixes #3747

This required adding a new ContextualDefaultOption class
to get a default callable that also receives the context.
Moreover, a but was fixed in the function that prompts
for the prepend/append_text, as if the file was not touched/modified,
instead of reusing the text provided in input, an empty text was used instead.
@giovannipizzi
Copy link
Member Author

@ConradJohnston could you check that this work as you expect? If this is the case, after adding tests this is ready to merge

ConradJohnston
ConradJohnston previously approved these changes Feb 24, 2020
Copy link
Contributor

@ConradJohnston ConradJohnston left a comment

Choose a reason for hiding this comment

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

Works great, thank you.

One curiosity - why does duplicate allow me to have identical labels for the code?
If one uses orm.Code.get_from_string(), it complains unless the code@computer label is unique.
I understand that this isn't the ID on which uniqueness is enforced, but given that there are convenience functions which do use this label, should we warn the user? Will make a separate issue if you agree that it's an oddity.

@ltalirz
Copy link
Member

ltalirz commented Feb 24, 2020

given that there are convenience functions which do use this label, should we warn the user?

We should, and there already is an issue for it #3303

@giovannipizzi
Copy link
Member Author

Thanks @ConradJohnston !

Do you happen to have time to add a test, by chance? I'll be a bit busy in the next days and if we have tests we can merge this.

@ConradJohnston
Copy link
Contributor

@giovannipizzi , yes, I'll try to get looking at it as soon as possible.

Sets prepend/append text when setting up the computer/code for the non-interactive tests.
The correct duplication was already tested by an assertion, but the prepend and append texts were set to the default value of an empty string.
@ConradJohnston
Copy link
Contributor

@giovannipizzi , have test coverage now. Can I push back to your branch?

@giovannipizzi
Copy link
Member Author

@ConradJohnston sure, thanks a lot! I just added you as a collaborator to my fork - not sure if this means you can push, in case you cannot I can set this after you accept the invite (GitHub might have changed this workflow recently? I remember I could set the role while inviting...)

@ConradJohnston
Copy link
Contributor

@ConradJohnston sure, thanks a lot! I just added you as a collaborator to my fork - not sure if this means you can push, in case you cannot I can set this after you accept the invite (GitHub might have changed this workflow recently? I remember I could set the role while inviting...)

Hi Giovanni , I've pushed my change now, so we'll need another reviewer.
Actually, the tests did already cover the duplication of these texts, so all I did was to ensure that the test code and computer objects have something other than an empty string for their prepend/append texts.

@giovannipizzi
Copy link
Member Author

Thanks a lot @ConradJohnston!
Indeed you are right, great (also better, it was an easier fix ;-) )

I cannot approve this myself - either you reprove it, or maybe @sphuber could approve and merge?

@giovannipizzi giovannipizzi marked this pull request as ready for review February 28, 2020 11:11
Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

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

Thanks guys

@sphuber sphuber merged commit d44dcbd into aiidateam:develop Feb 28, 2020
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.

Duplication of codes and computers via 'verdi' does not duplicate prepend and append text
4 participants