Permalink
Browse files

cleaning up tests and setup

  • Loading branch information...
1 parent 52db5de commit 9fb5600837d12eb263dfa235be2df10e3ba6471e @sorl sorl committed Feb 6, 2011
View
File renamed without changes.
View
@@ -1,54 +0,0 @@
-Changelog
-=========
-
-0.4.4
------
-* Rename and remake ChoicesGenerator -> ChoiceGenerator + ChoiceFieldGenerator
-
-0.4.3
------
-* Make generators take empty_value keyword argument
-
-0.4.2
------
-* Make ModelMockup take a factory instance as keyword argument for more
- flexibility
-
-0.4.1
------
-* Just a rename of Mockup to ModelMockup
-
-0.4.0
------
-* Major rewrite to use Factory
-
-0.2.6
------
-* Changing syntax to match Django Models & Forms
-
-* Renaming to django-mockups
-
-
-0.2.5
------
-
-* Fixing issue with ``--generate-fk`` option in management command. Thanks
- Mikko Hellsing for the `report and fix`_.
-
-.. _report and fix: http://github.com/gregmuellegger/django-autofixture/issues/issue/1/
-
-0.2.4
------
-
-* Using ``Autofixture.Values`` for defining initial values in ``Autofixture``
- subclasses.
-
-* Making autodiscover more robust. Don't break if some module can't be
- imported or throws any other exception.
-
-0.2.3
------
-
-* Fixing bug when a ``CharField`` with ``max_length`` smaller than 15 is used.
-
-* ``Mockup.field_generators`` accepts callables as values.
View
@@ -1,4 +1,4 @@
-DJANGO MOCKUPS
+django-mockups
==============
Copyright (c) 2010, Mikko Hellsing
All rights reserved.
@@ -27,7 +27,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-DJANGO AUTOFIXTURE
+django-autofixture
==================
Copyright (c) 2010, Gregor Müllegger
All rights reserved.
View
@@ -1,5 +1,3 @@
-include AUTHORS.txt
-include CHANGES.rst
-include LICENSE.txt
-include MANIFEST.in
-include README.rst
+include AUTHORS LICENSE README.rst
+recursive-include docs *
+recursive-include mockups/tests/media *
View
@@ -1,7 +1,6 @@
==============
django-mockups
==============
-
This app aims to provide a simple way of loading masses of randomly generated
test data into your development database. You can use a management command to
load test data through command line.
@@ -18,11 +17,9 @@ actually be spent on hacking.
Installation
============
-
You must make the ``mockups`` package available on your python path. Either
drop it into your project directory or install it from the python package index
-with ``pip install django-mockups``. You can also use ``easy_install
-django-mockups`` if you don't have pip available.
+with ``pip install django-mockups``.
To use the management command you must add ``'mockups'`` to the
``INSTALLED_APPS`` setting in your django settings file. You don't need to do
@@ -31,7 +28,6 @@ this if you want to use the ``mockups`` package only as library.
Management command
==================
-
The ``mockups`` accepts the following syntax::
django-admin.py mockups [options] app.Model:# [app.Model:# ...]
@@ -60,7 +56,6 @@ information::
Using mockups as tool for unittests
========================================
-
It has proofed that mockups have a great use for unittests. It has always
bugged me that creating complex models for testing their behaviour was
complicated. Sometimes models have strict restrictions or many related objects
@@ -102,7 +97,6 @@ All created entry models get one to three new categories assigned.
Setting custom values for fields
--------------------------------
-
However its often necessary to be sure that a specific field must have a
specific value. This is easily achieved with the use of ``Factory``::
@@ -117,7 +111,6 @@ specific value. This is easily achieved with the use of ``Factory``::
More
====
-
There is so much more to explore which might be useful for you and your
projects:
View
@@ -1,121 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Bootstrap a buildout-based project
-
-Simply run this script in a directory containing a buildout.cfg.
-The script accepts buildout command-line options, so you can
-use the -c option to specify an alternate configuration file.
-
-$Id$
-"""
-
-import os, shutil, sys, tempfile, urllib2
-from optparse import OptionParser
-
-tmpeggs = tempfile.mkdtemp()
-
-is_jython = sys.platform.startswith('java')
-
-# parsing arguments
-parser = OptionParser()
-parser.add_option("-v", "--version", dest="version",
- help="use a specific zc.buildout version")
-parser.add_option("-d", "--distribute",
- action="store_true", dest="distribute", default=False,
- help="Use Disribute rather than Setuptools.")
-
-parser.add_option("-c", None, action="store", dest="config_file",
- help=("Specify the path to the buildout configuration "
- "file to be used."))
-
-options, args = parser.parse_args()
-
-# if -c was provided, we push it back into args for buildout' main function
-if options.config_file is not None:
- args += ['-c', options.config_file]
-
-if options.version is not None:
- VERSION = '==%s' % options.version
-else:
- VERSION = ''
-
-USE_DISTRIBUTE = options.distribute
-args = args + ['bootstrap']
-
-to_reload = False
-try:
- import pkg_resources
- if not hasattr(pkg_resources, '_distribute'):
- to_reload = True
- raise ImportError
-except ImportError:
- ez = {}
- if USE_DISTRIBUTE:
- exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
- ).read() in ez
- ez['use_setuptools'](to_dir=tmpeggs, download_delay=0, no_fake=True)
- else:
- exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
- ).read() in ez
- ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
-
- if to_reload:
- reload(pkg_resources)
- else:
- import pkg_resources
-
-if sys.platform == 'win32':
- def quote(c):
- if ' ' in c:
- return '"%s"' % c # work around spawn lamosity on windows
- else:
- return c
-else:
- def quote (c):
- return c
-
-cmd = 'from setuptools.command.easy_install import main; main()'
-ws = pkg_resources.working_set
-
-if USE_DISTRIBUTE:
- requirement = 'distribute'
-else:
- requirement = 'setuptools'
-
-if is_jython:
- import subprocess
-
- assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
- quote(tmpeggs), 'zc.buildout' + VERSION],
- env=dict(os.environ,
- PYTHONPATH=
- ws.find(pkg_resources.Requirement.parse(requirement)).location
- ),
- ).wait() == 0
-
-else:
- assert os.spawnle(
- os.P_WAIT, sys.executable, quote (sys.executable),
- '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout' + VERSION,
- dict(os.environ,
- PYTHONPATH=
- ws.find(pkg_resources.Requirement.parse(requirement)).location
- ),
- ) == 0
-
-ws.add_entry(tmpeggs)
-ws.require('zc.buildout' + VERSION)
-import zc.buildout.buildout
-zc.buildout.buildout.main(args)
-shutil.rmtree(tmpeggs)
View
@@ -1,51 +0,0 @@
-# -*- coding: utf-8 -*-
-import os
-from fabric.api import abort, cd, local, env, run, settings, sudo
-
-
-#################
-# Documentation #
-#################
-
-def packagedocs():
- builddocs('html')
- try:
- os.mkdir('dist')
- except OSError:
- pass
- with cd('docs/_build/html'):
- local('find -print | zip docs.zip -@')
- local('mv docs/_build/html/docs.zip dist')
-
-def builddocs(output='html'):
- with cd('docs'):
- local('make %s' % output, capture=False)
-
-def opendocs(where='index', how='default'):
- '''
- Rebuild documentation and opens it in your browser.
-
- Use the first argument to specify how it should be opened:
-
- `d` or `default`: Open in new tab or new window, using the default
- method of your browser.
-
- `t` or `tab`: Open documentation in new tab.
-
- `n`, `w` or `window`: Open documentation in new window.
- '''
- import webbrowser
- docs_dir = os.path.join(
- os.path.dirname(os.path.abspath(__file__)),
- 'docs')
- index = os.path.join(docs_dir, '_build/html/%s.html' % where)
- builddocs('html')
- url = 'file://%s' % os.path.abspath(index)
- if how in ('d', 'default'):
- webbrowser.open(url)
- elif how in ('t', 'tab'):
- webbrowser.open_new_tab(url)
- elif how in ('n', 'w', 'window'):
- webbrowser.open_new(url)
-
-docs = opendocs
View
@@ -1,9 +0,0 @@
-#!/usr/bin/env python
-import os
-
-os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
-
-
-if __name__ == '__main__':
- from django.core.management import execute_from_command_line
- execute_from_command_line()
View
@@ -8,9 +8,11 @@
class IGNORE_FIELD(object):
pass
+
class CreateInstanceError(Exception):
pass
+
class Link(object):
'''
Handles logic of following or generating foreignkeys and m2m relations.
View
@@ -165,12 +165,15 @@ def generate(self):
lorem = lorem[:max(1, length)]
return lorem.strip()
+
class LoremSentenceGenerator(LoremGenerator):
method = 's'
+
class LoremHTMLGenerator(LoremGenerator):
method = 'p'
+
class LoremWordGenerator(LoremGenerator):
count = 7
method = 'w'
@@ -417,6 +420,7 @@ def generate(self):
filename = relpath(filename, settings.MEDIA_ROOT)
return filename
+
# TODO: try to get this thing out of here
class InstanceGenerator(Generator):
'''
@@ -607,4 +611,3 @@ def get_generator(self, field, **kwargs):
return IntegerGenerator(min_value=-field.MAX_BIGINT - 1,
max_value=field.MAX_BIGINT)
-
File renamed without changes.
@@ -6,11 +6,10 @@
from mockups import generators
from mockups import Factory
from mockups.base import ModelMockup, CreateInstanceError, Link
-from mockups_tests.mockups_test.models import y2k
-from mockups_tests.mockups_test.models import (
- SimpleModel, OtherSimpleModel, DeepLinkModel1, DeepLinkModel2,
- NullableFKModel, BasicModel, UniqueTestModel, UniqueTogetherTestModel,
- RelatedModel, O2OModel, M2MModel, ThroughModel, M2MModelThrough)
+from mockups_test.models import (y2k, SimpleModel, OtherSimpleModel,
+ DeepLinkModel1, DeepLinkModel2, NullableFKModel, BasicModel,
+ UniqueTestModel, UniqueTogetherTestModel, RelatedModel, O2OModel,
+ M2MModel, ThroughModel, M2MModelThrough)
class SimpleFactory(Factory):
File renamed without changes.
Oops, something went wrong.

0 comments on commit 9fb5600

Please sign in to comment.