Django packageutils
This is a utility collection for packaging Django App. The following features are available.
Unittest utility for running with setup.py
Unittest utility for dynamically adding models only used in the test
Automatically create user within syncdb command
How to install
Use pip comand or easy_install:
pip install django-packageutils
Directory tree assumed
django-packagename
+- setup.py
+- RELEASE-VERSION # used for git versioning
+- packagename # your package
+- __init__.py
+- models.py # or whatever
+- tests
+- __init__.py
+- test_models.py # or whatever
+- testapp # App only required in tests of this package
+- __init__.py
+- models.py
+- test # django project for testing
+- __init__.py
+- settings.py
+- manage.py
+- urls.py
+- runtests.py # for running test with setup.py
Unittest utility for running with setup.py
Write your runtests.py in your package directory as:
import os
from packageutils.test import get_package_runner
from packageutils.test import run_tests
def runtests(verbosity=1, interactive=True):
package_dir = os.path.dirname(__file__)
test_runner = get_package_runner(package_dir, verbosity, interactive)
run_tests(test_runner, ['some_application_name'])
if __name__ == '__main__':
runtests()
Add test suite to your setup.py as:
setup(
# ... some configures
install_requires = [
'distribute', # recommended
'setuptools-git', # recommended
'django-packageutils', # required
# and some other requires
],
test_suite = 'tests.runtests.runtests',
test_require = [
'django',
],
)
Then execute the following command:
python setup.py test
Unittest utility for dynamically adding models only used in the test
With Django default TestCase, you cannot add required models within test. Sometime you need extra models for testing your django package then you can use AppTestCase as:
from packageutils.testcase import AppTestCase
from testapp.models import Article
class TestAppTestCase(AppTestCase):
# Apps only required in this test
installed_apps = [
'packagename.tests.testapp',
]
# Middlewares only required in this test
middleware_classes = [
'testapp.middleware.SomeMiddlewareRequired',
]
def test_creation(self):
article = Article.objects.create(title='foo')
assert Article.objects.filter(title='foo').exists()
Automatically create user within syncdb command
Add packageutils.syncdb.autouser in INSTALLED_APPS then admin user is created automatically within syncdb command (password will be set as ‘admin’)
Metadata
Release files for django-packageutils 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-packageutils-0.1.0.tar.gz | 22.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_packageutils-0.1.0-py2.7.egg | Legacy Egg format | - | - | Details |
Total release size: 82.8 kB
Release files / django-packageutils-0.1.0.tar.gz
| Download URL | django-packageutils-0.1.0.tar.gz |
|---|---|
| Size | 22.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e067b3c8954d5550c5c69dd27e795259ac2f67e570bdfab5f03d7ab716db1be6
|
|
BLAKE2b-256 checksum How to use checksums |
c1a13ac729fd1f409ec3d7730bf7f7c79b6a91b6caac7e35743cf40770803d00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_packageutils-0.1.0-py2.7.egg
| Download URL | django_packageutils-0.1.0-py2.7.egg |
|---|---|
| Size | 60.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
7eed53f5806ca193b586d031579f5cc2667dfca2ef94b9c677f953943a5d2bae
|
|
BLAKE2b-256 checksum How to use checksums |
97f1e4aa0b9e3d93da23fe9ab33a91eb94f325649b55a71779cdbb41c8d9c8c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-packageutils 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.