|
| 1 | +Development |
| 2 | +=========== |
| 3 | + |
| 4 | +To contribute to `pytest-html` you can use `Pipenv`_ to manage a python virtual environment and |
| 5 | +`pre-commit`_ to help you with styling and formatting. |
| 6 | + |
| 7 | +To setup the virtual environment and pre-commit, run: |
| 8 | + |
| 9 | +.. code-block:: bash |
| 10 | +
|
| 11 | + $ pipenv install --dev |
| 12 | + $ pipenv run pre-commit install |
| 13 | +
|
| 14 | +If you're not using `Pipenv`_, run the following to install `pre-commit`_: |
| 15 | + |
| 16 | +.. code-block:: bash |
| 17 | +
|
| 18 | + $ pip install pre-commit |
| 19 | + $ pre-commit install |
| 20 | +
|
| 21 | +
|
| 22 | +Automated Testing |
| 23 | +----------------- |
| 24 | + |
| 25 | +All pull requests and merges are tested in `GitHub Actions`_ which are defined inside ``.github`` folder. |
| 26 | + |
| 27 | +To retrigger CI to run again for a pull request, you either use dropdown option, close and reopen pull-request |
| 28 | +or to just update the branch containing it. |
| 29 | + |
| 30 | +You can do this with `git commit --allow-empty` |
| 31 | + |
| 32 | +Running Tests |
| 33 | +------------- |
| 34 | + |
| 35 | +Python |
| 36 | +~~~~~~ |
| 37 | + |
| 38 | +You will need `Tox`_ installed to run the tests against the supported Python versions. If you're using `Pipenv`_ |
| 39 | +it will be installed for you. |
| 40 | + |
| 41 | +With `Pipenv`_, run: |
| 42 | + |
| 43 | +.. code-block:: bash |
| 44 | +
|
| 45 | + $ pipenv run tox |
| 46 | +
|
| 47 | +Otherwise, to install and run, do: |
| 48 | + |
| 49 | +.. code-block:: bash |
| 50 | +
|
| 51 | + $ pip install tox |
| 52 | + $ tox |
| 53 | +
|
| 54 | +JavaScript |
| 55 | +~~~~~~~~~~ |
| 56 | + |
| 57 | +You will need `npm`_ installed to run the JavaScript tests. Internally, we use `Grunt`_ and `QUnit`_ to run the tests. |
| 58 | + |
| 59 | +Once `npm`_ is installed, you can install all needed dependencies by running: |
| 60 | + |
| 61 | +.. code-block:: bash |
| 62 | +
|
| 63 | + $ npm install |
| 64 | +
|
| 65 | +Run the following to execute the tests: |
| 66 | + |
| 67 | +.. code-block:: bash |
| 68 | +
|
| 69 | + $ npm test |
| 70 | +
|
| 71 | +Documentation |
| 72 | +------------- |
| 73 | + |
| 74 | +Documentation is hosted on `Read the Docs`_, and is written in `RST`_. Remember to add any new files to the :code:`toctree` |
| 75 | +section in :code:`index.rst`. |
| 76 | + |
| 77 | +To build your documentation, run: |
| 78 | + |
| 79 | +.. code-block:: bash |
| 80 | +
|
| 81 | + $ tox -e docs |
| 82 | +
|
| 83 | +You can then run a local webserver to verify your changes compiled correctly. |
| 84 | + |
| 85 | +SASS/SCSS/CSS |
| 86 | +------------- |
| 87 | + |
| 88 | +You will need `npm`_ installed to compile the CSS, which is generated via `SASS/SCSS`_. |
| 89 | + |
| 90 | +Once `npm`_ is installed, you can install all needed dependencies by running: |
| 91 | + |
| 92 | +.. code-block:: bash |
| 93 | +
|
| 94 | + $ npm install |
| 95 | +
|
| 96 | +Run the following to generate the CSS: |
| 97 | + |
| 98 | +.. code-block:: bash |
| 99 | +
|
| 100 | + $ npm run build:css |
| 101 | +
|
| 102 | +Releasing a new version |
| 103 | +----------------------- |
| 104 | + |
| 105 | +Follow these steps to release a new version of the project: |
| 106 | + |
| 107 | +#. Update your local master with the upstream master (``git pull --rebase upstream master``) |
| 108 | +#. Create a new branch |
| 109 | +#. Update ``CHANGES.rst`` with the new version, today's date, and all changes/new features |
| 110 | +#. Commit and push the new branch and then create a new pull request |
| 111 | +#. Wait for tests and reviews and then merge the branch |
| 112 | +#. Once merged, update your local master again (``git pull --rebase upstream master``) |
| 113 | +#. Tag the release with the new release version (``git tag v<new tag>``) |
| 114 | +#. Push the tag (``git push upstream --tags``) |
| 115 | +#. Done. Check `Github Actions`_ for release progress. |
| 116 | + |
| 117 | +.. _GitHub Actions: https://github.com/pytest-dev/pytest-html/actions |
| 118 | +.. _Grunt: https://gruntjs.com |
| 119 | +.. _npm: https://www.npmjs.com |
| 120 | +.. _Pipenv: https://pipenv.pypa.io/en/latest |
| 121 | +.. _pre-commit: https://pre-commit.com |
| 122 | +.. _QUnit: https://qunitjs.com |
| 123 | +.. _Read The Docs: https://readthedocs.com |
| 124 | +.. _RST: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html |
| 125 | +.. _SASS/SCSS: https://sass-lang.com |
| 126 | +.. _Tox: https://tox.readthedocs.io |
0 commit comments