← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~dernils/duplicity/testing into lp:duplicity

 

nils has proposed merging lp:~dernils/duplicity/testing into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~dernils/duplicity/testing/+merge/323003

Fixed minor stuff in requirements.txt. Added a Dockerfile for testing.
Minor changes to README files. Added README-TESTING with some information on testing. 
-- 
Your team duplicity-team is requested to review the proposed merge of lp:~dernils/duplicity/testing into lp:duplicity.
=== added file 'Dockerfile.OTHER'
--- Dockerfile.OTHER	1970-01-01 00:00:00 +0000
+++ Dockerfile.OTHER	2017-04-23 10:11:11 +0000
@@ -0,0 +1,54 @@
+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
+#
+# Copyright 2017 Nils Tekampe <nils@xxxxxxxxxxx>
+#
+# This file is part of duplicity.
+#
+# Duplicity is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# Duplicity is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with duplicity; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+FROM ubuntu:16.04
+
+#Setting a working directory for everything else
+WORKDIR /duplicty 
+
+# Installing some pre-requisites
+RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/*
+RUN sudo apt-get update
+
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends apt-utils
+
+RUN apt-get install -y software-properties-common python-software-properties
+
+# The following packages are needed for testing duplicity
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python2.7
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python-dev 
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install librsync-dev 
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install lftp
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install par2
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install bzr
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python-setuptools
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python-pip
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install openssl
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install libssl-dev
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install intltool
+
+RUN pip install --upgrade pip
+
+# Branch the dupllicity repo for testing 
+RUN bzr branch lp:~dernils/duplicity/testing
+
+# Installing requirements for pip 
+RUN pip install -r ./testing/requirements.txt
+

=== added file 'README-TESTING.OTHER'
--- README-TESTING.OTHER	1970-01-01 00:00:00 +0000
+++ README-TESTING.OTHER	2017-04-23 10:11:11 +0000
@@ -0,0 +1,75 @@
+# Testing duplicty
+
+## Introduction
+Duplicitys test concept bases on unit test. 
+All tests are contained in the /testing folder of the main repository. 
+
+As to see in the following sketch, there are several levels of testing duplicity and each can be used directly.
+
+                                    ┌─────────────────────┐     
+                                    │    docker image     │     
+                                    ├─────────────────────┴────┐
+                                    │                          │
+                                    │  ┌──────────────────┐    │
+                                    │  │       tox        │    │
+                                    │  └──────────────────┘    │
+                                    │            │             │
+                                    │            ▼             │
+                                    │  ┌──────────────────┐    │
+                                    │  │    unittests     │    │
+                                    │  └──────────────────┘    │
+                                    │            │             │
+                                    │            ▼             │
+                                    │  ┌──────────────────┐    │
+                                    │  │    duplicity     │    │
+                                    │  └──────────────────┘    │
+                                    │                          │
+                                    └──────────────────────────┘
+1. Testing directly using __setup.py__
+Assuming that your machine has all the required dependencies installed, you can start all the unit tests by simply typing
+
+‘setup.py test‘ 
+
+
+2. Using __tox__
+Tox is a generic virtualenv management and test command line tool that is used for checking your package installs correctly with different Python versions and interpreters. It 
+runs the tests in each of the environments that are configured in the tox.ini file (see root folder of the repository)
+
+A tox run can be started simply by typing 
+
+‘tox‘
+
+from the main duplicity folder. 
+
+3. Via a __docker__ image 
+Testing on a developer's machine can be tricky. Testing duplicity requires a set of dependencies being installed and reacts sensitiviely to changes of the local python configuration. In order to make sure that such interactions do not pose any influence on executing the tests, docker is the technology of choice. 
+Along with the tests, a docker image has been created (cf. Dockerfile in root folder of repo) that ensure the following things:
+- It bases on a clean Ubunut 16.04
+- It installs all the required packages that are needed for testing
+- It then branches the repository of duplicty to the folder /duplicty/testing within the docker image
+- And installs all the required python packages (as defined in the requirements.txt)
+Therewith, the docker image provides a clean and reproducible environment for executing the tests of duplicty. 
+In order to get hands on the docker image you simply: 
+1) Install Docker on your machine (https://docs.docker.com/engine/installation/)
+2) Start the image docker run -it dernils/duplicitytest /bin/bash (if you did not use the image before, it will be downloaded automatically)
+3) At the prompt of the docker image type:
+‘cd /testing‘
+‘tox‘ 
+to start a run of the test cases. 
+
+## Dependencies for testing
+If you should prefer to execute the tests locally without using docker, the Dockerfile that is checked into the root folder of the repository contains useful information. It contains a section marked "The following packages are needed for testing duplicity". Within this section all dependencies that need to be installed on a machine to execute the test cases are identified. 
+
+## Working with test coverage
+Python makes it easy to determine, how well the tests cover the source code. 
+
+You first run the tests __under observation__ of the coverage script:
+‘coverage run setup.py test‘
+After that, a report can be generated by the use of the command:
+‘coverage html --omit="testing/*,/usr/*"‘
+
+The report will be generated and stored in the folder htmlcov. 
+
+
+
+


Follow ups