Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial stab at contrib tests + Travis SSH

  • Loading branch information...
commit 375efe09a4240916c95068234998947cccbfaaaf 1 parent 85eb510
@bitprophet bitprophet authored
Showing with 53 additions and 1 deletion.
  1. +9 −1 .travis.yml
  2. +44 −0 integration/test_contrib.py
View
10 .travis.yml
@@ -12,7 +12,15 @@ install:
- "if [[ $TRAVIS_PYTHON_VERSION == '2.5' ]]; then pip install multiprocessing; fi"
# Deal with issue on Travis builders re: multiprocessing.Queue :(
- "sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm"
-script: fab test
+before_script:
+ # Allow us to SSH passwordless to localhost
+ - ssh-keygen -f ~/.ssh/id_rsa -N ""
+ - cp ~/.ssh/{id_rsa.pub,authorized_keys}
+script:
+ # Normal tests
+ - fab test
+ # Integration tests
+ - fab test:"--tests\=integration"
notifications:
irc:
channels: "irc.freenode.org#fabric"
View
44 integration/test_contrib.py
@@ -0,0 +1,44 @@
+import types
+
+from fabric.api import env
+from fabric.contrib import files
+
+
+class Integration(object):
+ def setup(self):
+ pass
+ #env.host_string = "localhost"
+
+
+def tildify(path):
+ home = run("echo ~", quiet=True).stdout.strip()
+ return path.replace('~', home)
+
+def expect(path):
+ assert files.exists(tildify(path))
+
+def expect_contains(path, value):
+ assert files.contains(tildify(path), value)
+
+
+class TestTildeExpansion(object):
+ def test_append(self):
+ for target in ('~/append_test', '~/append_test with spaces'):
+ files.append(target, ['line'])
+ expect(target)
+
+ def test_exists(self):
+ for target in ('~/exists_test', '~/exists test with space'):
+ run("touch %s" % target)
+ expect(target)
+
+ def test_sed(self):
+ for target in ('~/sed_test', '~/sed test with space'):
+ run("echo 'before' > %s" % target)
+ files.sed(target, 'before', 'after')
+ expect_contains(target, 'after')
+
+ def test_upload_template(self):
+ for target in ('~/upload_template_test', '~/upload template test with space'):
+ files.upload_template(target, target)
+ expect(target)
Please sign in to comment.
Something went wrong with that request. Please try again.