Add sphinx-prompt
parent
bb4e9ed35a
commit
60a39964e2
|
@ -1,4 +1,6 @@
|
||||||
extensions = []
|
extensions = [
|
||||||
|
'sphinx-prompt',
|
||||||
|
]
|
||||||
templates_path = ['_templates']
|
templates_path = ['_templates']
|
||||||
source_suffix = '.rst'
|
source_suffix = '.rst'
|
||||||
master_doc = 'index'
|
master_doc = 'index'
|
||||||
|
|
|
@ -23,22 +23,22 @@ We recommend using a `virtualenv <https://virtualenv.pypa.io/en/stable/>`_.
|
||||||
1. Clone the repository. If you're planning to make pull request, you should fork
|
1. Clone the repository. If you're planning to make pull request, you should fork
|
||||||
the repository on GitHub and clone your fork instead of the main repo:
|
the repository on GitHub and clone your fork instead of the main repo:
|
||||||
|
|
||||||
.. code:: bash
|
.. prompt:: bash
|
||||||
|
|
||||||
$ git clone https://github.com/yourusername/cti-python-stix2.git
|
git clone https://github.com/yourusername/cti-python-stix2.git
|
||||||
|
|
||||||
2. Install develoment-related dependencies:
|
2. Install develoment-related dependencies:
|
||||||
|
|
||||||
.. code:: bash
|
.. prompt:: bash
|
||||||
|
|
||||||
$ cd cti-python-stix2
|
cd cti-python-stix2
|
||||||
$ pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
3. Install `pre-commit <http://pre-commit.com/#usage>`_ git hooks:
|
3. Install `pre-commit <http://pre-commit.com/#usage>`_ git hooks:
|
||||||
|
|
||||||
.. code:: bash
|
.. prompt:: bash
|
||||||
|
|
||||||
$ pre-commit install
|
pre-commit install
|
||||||
|
|
||||||
At this point you should be able to make changes to the code.
|
At this point you should be able to make changes to the code.
|
||||||
|
|
||||||
|
@ -65,15 +65,19 @@ or implements the features. Any code contributions to python-stix2 should come
|
||||||
with new or updated tests.
|
with new or updated tests.
|
||||||
|
|
||||||
To run the tests in your current Python environment, use the ``pytest`` command
|
To run the tests in your current Python environment, use the ``pytest`` command
|
||||||
from the root project directory::
|
from the root project directory:
|
||||||
|
|
||||||
$ pytest
|
.. prompt:: bash
|
||||||
|
|
||||||
|
pytest
|
||||||
|
|
||||||
This should show all of the tests that ran, along with their status.
|
This should show all of the tests that ran, along with their status.
|
||||||
|
|
||||||
You can run a specific test file by passing it on the command line::
|
You can run a specific test file by passing it on the command line:
|
||||||
|
|
||||||
$ pytest stix2/test/test_<xxx>.py
|
.. prompt:: bash
|
||||||
|
|
||||||
|
pytest stix2/test/test_<xxx>.py
|
||||||
|
|
||||||
To ensure that the test you wrote is running, you can deliberately add an
|
To ensure that the test you wrote is running, you can deliberately add an
|
||||||
``assert False`` statement at the beginning of the test. This is another benefit
|
``assert False`` statement at the beginning of the test. This is another benefit
|
||||||
|
@ -83,18 +87,22 @@ run) before making it pass.
|
||||||
`tox <https://tox.readthedocs.io/en/latest/>`_ allows you to test a package
|
`tox <https://tox.readthedocs.io/en/latest/>`_ allows you to test a package
|
||||||
across multiple versions of Python. Setting up multiple Python environments is
|
across multiple versions of Python. Setting up multiple Python environments is
|
||||||
beyond the scope of this guide, but feel free to ask for help setting them up.
|
beyond the scope of this guide, but feel free to ask for help setting them up.
|
||||||
Tox should be run from the root directory of the project:::
|
Tox should be run from the root directory of the project:
|
||||||
|
|
||||||
$ tox
|
.. prompt:: bash
|
||||||
|
|
||||||
|
tox
|
||||||
|
|
||||||
We aim for high test coverage, using the `coverage.py
|
We aim for high test coverage, using the `coverage.py
|
||||||
<http://coverage.readthedocs.io/en/latest/>`_ library. Though it's not an
|
<http://coverage.readthedocs.io/en/latest/>`_ library. Though it's not an
|
||||||
absolute requirement to maintain 100% coverage, all code contributions must
|
absolute requirement to maintain 100% coverage, all code contributions must
|
||||||
be accompanied by tests. To run coverage and look for untested lines of code,
|
be accompanied by tests. To run coverage and look for untested lines of code,
|
||||||
run::
|
run:
|
||||||
|
|
||||||
$ pytest --cov=stix2
|
.. prompt:: bash
|
||||||
$ coverage html
|
|
||||||
|
pytest --cov=stix2
|
||||||
|
coverage html
|
||||||
|
|
||||||
then look at the resulting report in ``htmlcov/index.html``.
|
then look at the resulting report in ``htmlcov/index.html``.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue