|
2 | 2 | Contributing
|
3 | 3 | ============
|
4 | 4 |
|
5 |
| -Contributions are welcome, and they are greatly appreciated! Every little bit |
6 |
| -helps, and credit will always be given. |
| 5 | +Run the tests |
| 6 | +------------- |
7 | 7 |
|
8 |
| -You can contribute in many ways: |
| 8 | +1. Install `tox <https://tox.wiki/en/latest/>`__. |
9 | 9 |
|
10 |
| -Types of Contributions |
11 |
| ----------------------- |
| 10 | +2. Run a supported version of MySQL or MariaDB. |
| 11 | + This is easiest with the official Docker images. |
| 12 | + For example: |
12 | 13 |
|
13 |
| -Report Bugs |
14 |
| -~~~~~~~~~~~ |
| 14 | + .. code-block:: console |
15 | 15 |
|
16 |
| -Report bugs via `Github Issues |
17 |
| -<https://github.com/adamchainz/django-mysql/issues>`_. |
| 16 | + docker run --detach --name mariadb -e MYSQL_ROOT_PASSWORD=hunter2 --publish 3306:3306 mariadb:10.7 |
18 | 17 |
|
19 |
| -If you are reporting a bug, please include: |
| 18 | +3. Run the tests by passing environment variables with your connection parameters. |
| 19 | + For the above Docker command: |
20 | 20 |
|
21 |
| -* Your versions of Django-MySQL, Django, and MySQL/MariaDB |
22 |
| -* Any other details about your local setup that might be helpful in |
23 |
| - troubleshooting, e.g. operating system. |
24 |
| -* Detailed steps to reproduce the bug. |
| 21 | + .. code-block:: console |
25 | 22 |
|
26 |
| -Fix Bugs |
27 |
| -~~~~~~~~ |
| 23 | + DB_HOST=127.0.0.1 DB_USER=root DB_PASSWORD='hunter2' tox -e py310-django40 |
28 | 24 |
|
29 |
| -Look through the GitHub issues for bugs. Anything tagged with "bug" |
30 |
| -is open to whoever wants to implement it. |
| 25 | + tox environments are split per Python and Django version. |
31 | 26 |
|
32 |
| -Implement Features |
33 |
| -~~~~~~~~~~~~~~~~~~ |
| 27 | + You can run a subset of tests by passing them after ``--`` like: |
34 | 28 |
|
35 |
| -Look through the GitHub issues for features. Anything tagged with "help wanted" |
36 |
| -and not assigned to anyone is open to whoever wants to implement it - please |
37 |
| -leave a comment to say you have started working on it, and open a pull request |
38 |
| -as soon as you have something working, so that Travis starts building it. |
| 29 | + .. code-block:: console |
39 | 30 |
|
40 |
| -Issues without "help wanted" generally already have some code ready in the |
41 |
| -background (maybe it's not yet open source), but you can still contribute to |
42 |
| -them by saying how you'd find the fix useful, linking to known prior art, or |
43 |
| -other such help. |
| 31 | + DB_HOST=127.0.0.1 DB_USER=root DB_PASSWORD='hunter2' tox -e py310-django40 -- tests/testapp/test_cache.py |
44 | 32 |
|
45 |
| -Write Documentation |
46 |
| -~~~~~~~~~~~~~~~~~~~ |
47 |
| - |
48 |
| -Django-MySQL could always use more documentation, whether as part of the |
49 |
| -official Django-MySQL docs, in docstrings, or even on the web in blog posts, |
50 |
| -articles, and such. Write away! |
51 |
| - |
52 |
| -Submit Feedback |
53 |
| -~~~~~~~~~~~~~~~ |
54 |
| - |
55 |
| -The best way to send feedback is to file an issue via `Github Issues |
56 |
| -<https://github.com/adamchainz/django-mysql/issues>`_. |
57 |
| - |
58 |
| -If you are proposing a feature: |
59 |
| - |
60 |
| -* Explain in detail how it would work. |
61 |
| -* Keep the scope as narrow as possible, to make it easier to implement. |
62 |
| -* Remember that this is a volunteer-driven project, and that contributions |
63 |
| - are welcome :) |
64 |
| -* Link to any prior art, e.g. MySQL/MariaDB documentation that details the |
65 |
| - necessary database features |
66 |
| - |
67 |
| -Get Started! |
68 |
| ------------- |
69 |
| - |
70 |
| -Ready to contribute? Here's how to set up Django-MySQL for local development. |
71 |
| - |
72 |
| -1. Fork the Django-MySQL repo on GitHub. |
73 |
| -2. Clone your fork locally: |
74 |
| - |
75 |
| - .. code-block:: sh |
76 |
| -
|
77 |
| - $ git clone [email protected]:your_name_here/django-mysql.git |
78 |
| - $ cd django-mysql/ |
79 |
| -
|
80 |
| -3. Check you have a supported version of MySQL or MariaDB running and that the |
81 |
| - settings in ``tests/settings.py`` will work for connecting. This involves |
82 |
| - making sure you can connect from your terminal with the plain command |
83 |
| - ``mysql`` with no options, i.e. as your current user. |
84 |
| - |
85 |
| - On Ubuntu, this can be done with the commands below: |
86 |
| - |
87 |
| - .. code-block:: sh |
88 |
| -
|
89 |
| - $ sudo apt-get install mysql-server-5.7 |
90 |
| - $ mysql -uroot -p -e "CREATE USER '$(whoami)'@localhost; GRANT ALL PRIVILEGES ON *.* TO '$(whoami)'@localhost;" |
91 |
| - # Enter the password for root you set in the apt dialog |
92 |
| -
|
93 |
| - On Mac OS X, this can be done with something like: |
94 |
| - |
95 |
| - .. code-block:: sh |
96 |
| -
|
97 |
| - $ brew install mariadb |
98 |
| - $ mysql.server start |
99 |
| - $ mysql -uroot -e "CREATE USER '$(whoami)'@localhost; GRANT ALL PRIVILEGES ON *.* TO '$(whoami)'@localhost;" |
100 |
| -
|
101 |
| - If you want to use a different user or add a password, you can patch the |
102 |
| - settings file in your local install. |
103 |
| - |
104 |
| -5. Install ``tox`` and run the tests for Python 3.10 + Django 4.0: |
105 |
| - |
106 |
| - .. code-block:: sh |
107 |
| -
|
108 |
| - $ python -m pip install tox |
109 |
| - $ tox -e py310-django40 |
110 |
| -
|
111 |
| -6. To make changes, create a branch for local development: |
112 |
| - |
113 |
| - .. code-block:: sh |
114 |
| -
|
115 |
| - $ git checkout -b name-of-your-bugfix-or-feature |
116 |
| -
|
117 |
| - ...and hack away! |
118 |
| - |
119 |
| -7. Commit your changes and push your branch to GitHub: |
120 |
| - |
121 |
| - .. code-block:: sh |
122 |
| -
|
123 |
| - $ git add . |
124 |
| - $ git commit -m "Your detailed description of your changes." |
125 |
| - $ git push origin name-of-your-bugfix-or-feature |
126 |
| -
|
127 |
| -8. Submit a pull request through the GitHub website. This will trigger the |
128 |
| - Travis build which runs the tests against all supported versions of Python, |
129 |
| - Django, and MySQL/MariaDB. |
130 |
| - |
131 |
| -Testing Tips |
132 |
| ------------- |
133 |
| - |
134 |
| -To only run a particular test file, you can run with the path to that file: |
135 |
| - |
136 |
| -.. code-block:: sh |
137 |
| -
|
138 |
| - $ tox -- tests/testapp/test_some_feature.py |
139 |
| -
|
140 |
| -You can also pass other pytest arguments through ``tox`` after the ``--`` |
141 |
| -separator. There are lots of other useful features, most of which you can check |
142 |
| -out in the `pytest docs <http://docs.pytest.org/en/latest/>`_! |
| 33 | + You can also pass other pytest arguments after the ``--``. |
0 commit comments