Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Automate the installation tests.

  • Loading branch information...
commit 9261c534252f8612d410ca7961dea5b7f14a43d1 1 parent 92065ce
Andrea Francia authored
8 TODO.txt
View
@@ -1,15 +1,9 @@
Feature: trash-rm
TODO:
- - trash-rm wrap-up
- x -> fix newling in trash-rm usage
- - -> man page for trash-rm
- x -> write man page for trash-rm
- - -> install the man page with setup.py
- - -> switch to distutils
- - -> make it install entry points
- man pages:
+ - add test for checking man page installation
- add DONATION to all pages
- make all BUGS to point to github
- unificate "SEE ALSO" for all man pages
62 check_release_installation.py
View
@@ -6,18 +6,38 @@
from trashcli.trash import version
-class TestInstallation:
- def setUp(self):
- self.ssh = Connection('root@' + TARGET_HOST)
+def main():
+ check_connection()
+ check_installation(normal_installation)
+ check_installation(easy_install_installation)
+
+def check_installation(installation_method):
+ tc = LinuxBox('root@' + TARGET_HOST, installation_method)
+ print "== Cleaning any prior software installation"
+ tc.clean_any_prior_installation()
+ print "== Copying software"
+ tc.copy_tarball()
+ print "== Installing software"
+ tc.install_software()
+ print "== Checking all program were installed"
+ tc.check_all_programs_are_installed()
+
+
+class LinuxBox:
+ def __init__(self, address, installation_method):
+ self.ssh = Connection(address)
self.executables = [
'trash-put', 'trash-list', 'trash-rm', 'trash-empty',
'restore-trash', 'trash']
- self.uninstall_software()
- self.install_software()
- def uninstall_software(self):
+ self.tarball="trash-cli-%s.tar.gz" % version
+ self.installation_method = installation_method
+ def clean_any_prior_installation(self):
+ "clean any prior installation"
for executable in self.executables:
self._remove_executable(executable)
self._assert_command_removed(executable)
+ def _remove_executable(self, executable):
+ self.ssh.run('rm -f $(which %s)' % executable).assert_succesful()
def _assert_command_removed(self, executable):
result = self.ssh.run('which %s' % executable)
command_not_existent_exit_code_for_which = 1
@@ -25,26 +45,38 @@ def _assert_command_removed(self, executable):
'Which returned: %s\n' % result.exit_code +
'and reported: %s' % result.stdout
)
- def _remove_executable(self, executable):
- self.ssh.run('rm -f $(which %s)' % executable).assert_succesful()
+ def copy_tarball(self):
+ self.ssh.put('dist/%s' % self.tarball)
def install_software(self):
- tarball="trash-cli-%s.tar.gz" % version
- self.ssh.put('dist/%(tarball)s' % locals())
- self.ssh.run('tar xvfz %(tarball)s' % locals())
- self.ssh.run('cd %s && python setup.py install'
- % strip_end(tarball, '.tar.gz')).assert_succesful()
- def test_should_install_all_commands(self):
+ def run_checked(command):
+ result = self.ssh.run(command)
+ result.assert_succesful()
+ self.installation_method(self.tarball, run_checked)
+ def check_all_programs_are_installed(self):
for command in self.executables:
result = self.ssh.run('%(command)s --version' % locals())
assert_not_equals(127, result.exit_code,
"Exit code was: %s, " % result.exit_code +
"Probably command not found, command: %s" % command)
+def normal_installation(tarball, check_run):
+ directory = strip_end(tarball, '.tar.gz')
+ check_run('tar xfvz %s' % tarball)
+ check_run('cd %s && '
+ 'python setup.py install' % directory)
+
+def easy_install_installation(tarball, check_run):
+ check_run('easy_install %s' % tarball)
+
def strip_end(text, suffix):
if not text.endswith(suffix):
return text
return text[:-len(suffix)]
+def check_connection():
+ suite = nose.loader.TestLoader().loadTestsFromTestClass(TestConnection)
+ nose.run(suite=suite)
+
class TestConnection:
def __init__(self):
self.ssh = Connection(TARGET_HOST)
@@ -59,4 +91,4 @@ def test_should_report_exit_code(self):
assert_equals(134, result.exit_code)
if __name__ == '__main__':
- nose.runmodule()
+ main()
31 docs/how-to-build-and-upload-a-new-release.txt
View
@@ -3,42 +3,25 @@ How to build a release
Update the version number:
- vim trashcli/trash.py
- version="$(python setup.py --version)"
+ vim trashcli/trash.py
+ version="$(python setup.py --version)"
Run all tests:
- nosetests
+ nosetests
Test the installation from tarball:
python setup.py sdist
- tarball=trash-cli-${version:?}.tar.gz
-
- scp dist/$tarball root@192.168.56.101:
-
- ssh root@192.168.56.101 "
- tar xvfz $tarball
- cd ${tarball%%.tar.gz}
- python setup.py install
- trash-put --help
- "
-
-Test the installation using easy_install:
-
- ssh root@192.168.56.101 "
- apt-get install python-setuptools
- easy_install "$tarball"
- trash-put --help
- "
+ python check_release_installation.py
Register and upload:
- python setup.py register
- python setup.py sdist upload
+ python setup.py register
+ python setup.py sdist upload
Now you can tag the repo status:
- git tag "${version:?}"
+ git tag "${version:?}"
-EOF
Please sign in to comment.
Something went wrong with that request. Please try again.