Skip to content

Commit

Permalink
Add requirements.txt and README instructions for test project setup
Browse files Browse the repository at this point in the history
Closes #32.
  • Loading branch information
fazpu authored and axnsan12 committed Jan 1, 2018
1 parent faf81e7 commit caa397b
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 11 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ You want to contribute some code? Great! Here are a few steps to get you started
$ virtualenv venv
$ source venv/bin/activate
(venv) $ pip install -e .[validation]
(venv) $ pip install -rrequirements/dev.txt -rrequirements/test.txt
(venv) $ pip install -rrequirements/dev.txt -rrequirements/test.txt "Django>=1.11.7"
#. **Make your changes and check them against the test project**

.. code:: console
(venv) $ cd testproj
(venv) $ python manage.py migrate
(venv) $ cat createsuperuser.py | python manage.py shell
(venv) $ python manage.py shell -c "import createsuperuser"
(venv) $ python manage.py runserver
(venv) $ firefox localhost:8000/swagger/
Expand Down
20 changes: 20 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,26 @@ You can use the specification outputted by this library together with
See the github page linked above for more details.

.. _readme-testproj:

6. Example project
==================

For additional usage examples, you can take a look at the test project in the ``testproj`` directory:

.. code:: console
$ git clone https://github.com/axnsan12/drf-yasg.git
$ cd drf-yasg
$ virtualenv venv
$ source venv/bin/activate
(venv) $ cd testproj
(venv) $ pip install -r requirements.txt
(venv) $ python manage.py migrate
(venv) $ python manage.py shell -c "import createsuperuser"
(venv) $ python manage.py runserver
(venv) $ firefox localhost:8000/swagger/
**********
Background
**********
Expand Down
8 changes: 1 addition & 7 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,4 @@ pytest-cov>=2.5.1
git+https://github.com/pytest-dev/pytest-django.git@94cccb956435dd7a719606744ee7608397e1eafb
datadiff==2.0.0

# test project requirements
Pillow>=4.3.0
pygments>=2.2.0
django-cors-headers>=2.1.0
django-filter>=1.1.0,<2.0; python_version == "2.7"
django-filter>=1.1.0; python_version >= "3.4"
djangorestframework-camel-case>=0.2.0
-r testproj.txt
7 changes: 7 additions & 0 deletions requirements/testproj.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# test project requirements
Pillow>=4.3.0
pygments>=2.2.0
django-cors-headers>=2.1.0
django-filter>=1.1.0,<2.0; python_version == "2.7"
django-filter>=1.1.0; python_version >= "3.4"
djangorestframework-camel-case>=0.2.0
11 changes: 9 additions & 2 deletions testproj/createsuperuser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
from __future__ import print_function

from django.contrib.auth.models import User

User.objects.filter(username='admin').delete()
User.objects.create_superuser('admin', 'admin@admin.admin', 'passwordadmin')
username = 'admin'
email = 'admin@admin.admin'
password = 'passwordadmin'
User.objects.filter(username=username).delete()
User.objects.create_superuser(username, email, password)

print("Created superuser '%s <%s>' with password '%s'" % (username, email, password))
3 changes: 3 additions & 0 deletions testproj/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
drf-yasg[validation]
Django>=1.11.7
-r ../requirements/testproj.txt

0 comments on commit caa397b

Please sign in to comment.