Commit 3a56c023 authored by chris's avatar chris
Browse files

Fixed unittest command.

parent 35885cfc
...@@ -16,11 +16,15 @@ Requires: ...@@ -16,11 +16,15 @@ Requires:
Installation Installation
------------ ------------
$ sudo python setup.py install sudo python setup.py install
Or via pip with: Or via pip with:
$ sudo pip install https://github.com/chrisspen/django-database-files/zipball/master sudo pip install https://github.com/chrisspen/django-database-files/zipball/master
You can run unittests with:
python setup.py test
Usage Usage
----- -----
...@@ -53,8 +57,3 @@ To delete all files in the database and file system not referenced by any model ...@@ -53,8 +57,3 @@ To delete all files in the database and file system not referenced by any model
fields, run: fields, run:
$ python manage.py database_files_cleanup $ python manage.py database_files_cleanup
Test suite
----------
$ ./run_tests.sh
VERSION = (0, 1, 3) VERSION = (0, 1, 4)
__version__ = '.'.join(map(str, VERSION)) __version__ = '.'.join(map(str, VERSION))
\ No newline at end of file
...@@ -15,7 +15,10 @@ class DatabaseFilesTestCase(TestCase): ...@@ -15,7 +15,10 @@ class DatabaseFilesTestCase(TestCase):
# Create default thing storing reference to file # Create default thing storing reference to file
# in the local media directory. # in the local media directory.
fqfn = os.path.join(DIR,'media/i/special/test.txt') media_dir = os.path.join(DIR,'media/i/special')
if not os.path.isdir(media_dir):
os.makedirs(media_dir)
fqfn = os.path.join(media_dir,'test.txt')
open(fqfn,'w').write('hello there') open(fqfn,'w').write('hello there')
o = Thing() o = Thing()
o.upload = 'i/special/test.txt' o.upload = 'i/special/test.txt'
......
#!/bin/bash
PYTHONPATH=. DJANGO_SETTINGS_MODULE="database_files.tests.settings" django-admin.py test tests
\ No newline at end of file
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from distutils.core import setup import os
from distutils.core import setup, Command
import database_files import database_files
class TestCommand(Command):
description = "Runs unittests."
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
os.system('django-admin.py test --pythonpath=. --settings=database_files.tests.settings tests')
setup( setup(
name='django-database-files', name='django-database-files',
version=database_files.__version__, version=database_files.__version__,
...@@ -23,4 +35,7 @@ setup( ...@@ -23,4 +35,7 @@ setup(
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python', 'Programming Language :: Python',
], ],
cmdclass={
'test': TestCommand,
},
) )
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment