Skip to content
This repository was archived by the owner on Dec 27, 2021. It is now read-only.

Update of base.Role + tests #112

Merged
merged 7 commits into from
Jan 31, 2013
Merged

Update of base.Role + tests #112

merged 7 commits into from
Jan 31, 2013

Conversation

jbzdak
Copy link
Contributor

@jbzdak jbzdak commented Jan 30, 2013

Should be OK now.

@diogobaeder
Copy link
Contributor

There's an error in the build. Can you run it and fix what's wrong?

If in doubt, refer to here: https://provy.readthedocs.org/en/latest/contributing.html#how-to-develop

@jbzdak
Copy link
Contributor Author

jbzdak commented Jan 30, 2013

You mean the:

./provy/core/roles.py:485: W801 redefinition of unused 'dirname' from line
11
make: *** [build] Error 1

I have looked into it, and code is legit, it is a flake8 glitch.

I have no idea what to do with it.
jb:)

2013/1/30 Diogo Baeder notifications@github.com

There's an error in the build. Can you run it and fix what's wrong?

If in doubt, refer to here:
https://provy.readthedocs.org/en/latest/contributing.html#how-to-develop


Reply to this email directly or view it on GitHubhttps://github.com//pull/112#issuecomment-12907959.

@jbzdak
Copy link
Contributor Author

jbzdak commented Jan 30, 2013

OK error suppressed.

@@ -189,7 +196,11 @@ class MySampleRole(Role):
def cleanup(self):
pass
'''
pass
for path in self._paths_to_remove:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is interesting. There's a problem, though: every Role subclass expected the cleanup() method to not do anything, so they don't call super() to cleanup.

So, two things have to change:

  1. You must call cleanup() from super() in all roles that overwrite it;
  2. You need to change the docstring, because as it is now it doesn't seem to me that I should be careful about this method and remember to call it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is other solution that wouldn't break existing code:

  1. add method base_cleanup and call that in addition to cleanup when cleaning up after provyfile.
  2. When calling cleanup check whether it called Role.cleanup and if not log warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nevertheless i called supper in all all Roles I found.

@diogobaeder diogobaeder mentioned this pull request Jan 31, 2013
self.role.execute_python_script("script", False, False)

self.assertTrue(isinstance(values['put_file'].mock_calls[0][1][0], StringIO))
@istest
Copy link
Contributor

Choose a reason for hiding this comment

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

Lacking a line space between this test case and the previous test. Are you running "make build" when changing your code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of the time yes.

Nevertheless fixed it.

diogobaeder added a commit that referenced this pull request Jan 31, 2013
@diogobaeder diogobaeder merged commit 2817efd into python-provy:master Jan 31, 2013
@diogobaeder
Copy link
Contributor

Looks good enough now. Some things to fix, yet, but we can go on improving it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants