Skip to content

Commit

Permalink
Improve doc and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuluPro committed Aug 30, 2015
1 parent 614865d commit e987148
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 18 deletions.
6 changes: 3 additions & 3 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Directory to be used for temporary files.
Default: ``tempfile.gettempdir()``

DBBACKUP_TMP_FILE_MAX_SIZE
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~

Maximum size in bytes for file handling in memory before write a temporary
file on ``DBBACKUP_TMP_DIR``.
Expand Down Expand Up @@ -91,14 +91,14 @@ The file name extension used for MySQL backups.
Default: ``'mysql'``

DBBACKUP_POSTGRESQL_EXTENSION
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The file name extension used for Postgres and PostGIS backups.

Default: ``'psql'``

DBBACKUP_SQLITE_EXTENSION
~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~

The file name extension used for SQLite backups.

Expand Down
61 changes: 61 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Contributing guide
==================

Dbbackup is a free license software where all help are welcomed. This
documentation aims to help users or developers to bring their contributions
to this project.

Submit a bug, issue or enhancement
----------------------------------

All communication are made with `GitHub issues`_. Do not hesitate to open a
issue if:

- You have an improvement idea
- You found a bug
- You've got a question
- More generaly something seems wrong for you

.. _`GitHub issues`: https://github.com/django-dbbackup/django-dbbackup/issues

Make a patch
------------

We use `GitHub pull requests`_ for manage all patches. For a better handling
of requests we advise you to:

#. Fork the project and make a new branch
#. Make your changes with tests if possible and documentation if needed
#. Push changes to your fork repository and test it with Travis
#. If succeed, open a pull request
#. Upset us until we give you an answer

.. _`GitHub pull requests`: https://github.com/django-dbbackup/django-dbbackup/pulls

Test code
~~~~~~~~~

You can test your code in local machine with the ``runtests.py`` script:

::

cd tests
python runtests.py

We advise you to launch it with Python 2 & 3 before push and try it in Travis.

Online CI
---------

We use `Travis`_ for tests Dbbackup with a matrix of components' version: Several version of Django and several versions of Python including 2, 3 and PyPy.

.. image:: https://api.travis-ci.org/django-dbbackup/django-dbbackup.svg
:target: https://travis-ci.org/django-dbbackup/django-dbbackup

Code coverage is ensured with `Coveralls`_ and has not yet minimum coverage limit.

.. image:: https://coveralls.io/repos/django-dbbackup/django-dbbackup/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/django-dbbackup/django-dbbackup?branch=master

.. _Travis: https://travis-ci.org/django-dbbackup/django-dbbackup
.. _Coveralls: https://coveralls.io/github/django-dbbackup/django-dbbackup
5 changes: 3 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Contents:
installation
configuration
storage
contributing
faq

.. warning::
Expand All @@ -27,7 +28,7 @@ Contents:
Compatibility
-------------

Django Database Backup supports Pypy, Python 2.7, 3.2 to 3.4 and Django greater than
Django Database Backup supports PyPy, Python 2.7, 3.2 to 3.4 and Django greater than
1.6.

Management Commands
Expand Down Expand Up @@ -117,7 +118,7 @@ Other Resources

Source code here:

https://github.com/mjs7231/django-dbbackup
https://github.com/django-dbbackup/django-dbbackup

PyPi project:

Expand Down
2 changes: 2 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Adding in your project

In your ``settings.INSTALLED_APPS``, make sure you have the following:

::

INSTALLED_APPS = (
...
'dbbackup', # django-dbbackup
Expand Down
25 changes: 25 additions & 0 deletions tests/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
================================
Django project for test Dbbackup
================================

This module is a fake Django project for test Django Dbbackup. It contains
project settings in ``runtests.py`` and an application named :mod:`testapp`.

Tests are stored in :mod:`dbbackup.tests` and for run them you must launch:

::

python runtests.py

In fact, ``runtests.py`` acts as a ``manage.py`` file and all Django command
are available. So you could launch:

::

python runtests.py shell

For get a Python shell configured with the test project. Also all test
command options are available and usable for run only some chosen tests.
See `Django test command documentation`_ for more informations about it.

.. _`Django test command documentation`: https://docs.djangoproject.com/en/stable/topics/testing/overview/#running-tests
24 changes: 11 additions & 13 deletions tests/runtests.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#!/usr/bin/env python

"""
Configuration and launcher for dbbackup tests.
"""
import os
import sys
import django
from django.conf import settings
from django.core.management import call_command

here = os.path.dirname(os.path.abspath(__file__))
parent = os.path.dirname(here)
sys.path[0:0] = [here, parent]
# Add testproject dbbackup in path
HERE = os.path.dirname(os.path.abspath(__file__))
PARENT_DIR = os.path.dirname(HERE)
sys.path[0:0] = [HERE, PARENT_DIR]

# Settings
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MEDIA_ROOT = os.path.join(BASE_DIR, 'tests/media')
INSTALLED_APPS = (
Expand Down Expand Up @@ -39,15 +43,9 @@
def main():
if django.VERSION >= (1, 7):
django.setup()
if sys.argv[-1] == 'shell':
call_command('shell')
sys.exit(0)
else:
# call_command('test', *sys.argv[2:])
from django.test.runner import DiscoverRunner
runner = DiscoverRunner(failfast=True, verbosity=int(os.environ.get('DJANGO_DEBUG', 1)))
failures = runner.run_tests(['dbbackup'], interactive=True)
sys.exit(failures)
command_args = sys.argv[1:] or ['test', 'dbbackup']
call_command(*command_args)
exit(0)

if __name__ == '__main__':
main()

0 comments on commit e987148

Please sign in to comment.