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
Improve local mode #93
Conversation
Hi Dave! I had a look at your pull request and have a few comments/questions:
Traceback (most recent call last):
File "tests/all.py", line 149, in testSudoPrefix
run_result = cuisine.run(cmd)
File "/home/sebastien/Projects/Local/lib/python/cuisine.py", line 237, in run
return run_local(*args, **kwargs)
File "/home/sebastien/Projects/Local/lib/python/cuisine.py", line 144, in run_local
return _run_command_local(command, shell, combine_stderr, sudo)
File "/home/sebastien/Projects/Local/lib/python/cuisine.py", line 153, in _run_command_local
from fabric.operations import error
ImportError: cannot import name error
Thanks! |
On the latter two points (issues with the patch):
As far as the complexity of def testCd( self ): # the tests assume mode(MODE_LOCAL) == True
with cd('/tmp'):
self.assertEqual(cuisine.run('pwd'), '/tmp') This actually fails in the current incarnation of cuisine, because |
Oh, I see -- this is great. Maybe more tests would be great to show the extend of features covered? I'm just a little bit worried about mimicking to closely how Fabric works, as we'll need to make sure that this actually works as expected (hence the need for a more extensive test suite). Overall, it's a lot of work for something that looks to me as an edge case, but I guess it's a good thing to make cuisine.run behave as closely as possible to fabric's run, even in local mode. |
You're right, it does seem like a lot of work for something that's generally an edge case. I've been thinking about going back to just a normal 'remote' SSH connection to localhost for some of the more elaborate things I'm trying to do with mode_local. Still, I think it has its uses (especially in prototyping locally when you don't have access to test machines). That last commit should fix that error handling import back to at least Fabric 1.1. Let me know if the tabs/spaces are still an issue, I'm starting to distrust my editor setup. |
OK, I'll merge it, thanks! |
OK, now the
|
It works on my end, but if I had a dollar for every time I've heard that... :-) What version of Fabric/Python are you running on? I'll try to reproduce and fix the issue if possible... |
I use Python 2.7.3 and Fabric 1.2.2 -- but I thought about it and I think I'll revert the pull request (and try to salvage as much as possible from what you did): my gut feeling was that it is a lot of complexity for really edge cases, which, as you suggested it, can be worked around with using a local SSH connection. What I will do though is to be explicit about the limitations of I really liked how you updated the test suite! |
You'll probably want to remove the last four LocalExecution test methods when you revert, since they'll be testing things that don't actually work in mode_local without the elaborate I've been thinking about trying to add more tests, because it's nice to have them to ensure that changes aren't breaking anything. The main issue I see is that most of the behavior you'd really want to test requires a remote test machine to run the tasks against. I've been doing my development using Vagrant, but that would be a pretty heavy dependency to just run tests. Have you given any thought to how to test cuisine's tasks remotely? |
This set of commits adds tests for some discrepancies between cuisine.run() and fabric.run() in local mode, then adds fixes for those discrepancies. Most changes have to do with wrapping commands the same way that fabric does so that various context managers and env variables get picked up and applied properly.