Skip to content

Commit 595a70d

Browse files
committed
updating testing doc and a few changes to contributing.md
1 parent e679215 commit 595a70d

File tree

2 files changed

+55
-75
lines changed

2 files changed

+55
-75
lines changed

CONTRIBUTING.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Welcome to the Nipype repository! We're excited you're here and want to contribu
44

55
These guidelines are designed to make it as easy as possible to get involved. If you have any questions that aren't discussed below, please let us know by opening an [issue][link_issues]!
66

7-
Before you start you'll need to set up a free [GitHub][link_github] account and sign in. Here are some [instructions][link_signupinstructions].
7+
Before you start you'll need to set up a free [GitHub][link_github] account and sign in, here are some [instructions][link_signupinstructions].
8+
If you are not familiar with version control system and Git,
9+
you will find introduction and links to tutorials [here](http://www.reproducibleimaging.org/module-reproducible-basics/02-vcs/).
810

911
Already know what you're looking for in this guide? Jump to the following sections:
1012
* [Understanding issue labels](#issue-labels)
@@ -47,30 +49,35 @@ This allows other members of the Nipype development team to confirm that you are
4749

4850
**2. [Fork][link_fork] the [Nipype repository][link_nipype] to your profile.**
4951

50-
This is now your own unique copy of Nipype.
52+
This is now your own unique copy of Nipype repository.
5153
Changes here won't affect anyone else's work, so it's a safe space to explore edits to the code!
5254

53-
Make sure to [keep your fork up to date][link_updateupstreamwiki] with the master repository.
55+
You can clone your Nipype repository in order to create a local copy of the code on your machine.
56+
In your local Nipype directory, run `pip install -e .[dev]`.
57+
This will add your version of nipype to your local python environment and
58+
install dependencies needed for development.
5459

55-
**3. Make the changes you've discussed.**
60+
Make sure to [keep your fork up to date][link_updateupstreamwiki] with the original Nipype repository.
5661

57-
If you're adding a new tool from an existing neuroimaging toolkit (e.g., 3dDeconvolve from AFNI), check out the [guide for adding new interfaces to Nipype][link_new_interfaces].
62+
**3. Make the changes you've discussed.**
5863

59-
To confirm that your changes worked as intended, [clone your fork][link_cloning] to create a local directory.
60-
In this local directory, run `python setup.py develop`.
61-
This will add your version of nipype to your local python environment.
64+
If you're adding a new tool from an existing neuroimaging toolkit (e.g., 3dDeconvolve from AFNI),
65+
check out the [guide for adding new interfaces to Nipype][link_new_interfaces].
6266

63-
Then, in this local nipype directory, run `make check-before-commit`. If you get no errors, you're ready to submit your changes!
67+
When you are working on your changes, you should test frequently if you are not breaking the existing code,
68+
more on testing you will find [the testing section of Nipype documentation](http://nipype.readthedocs.io/en/latest/devel/testing_nipype.html).
6469

65-
**4. Submit a [pull request][link_pullrequest].**
70+
It's a good practice to create a new branch of your Nipype repository for a new set of changes.
6671

67-
Submit a new pull request for your changes, using the tags outlined in the [tagging pull requests section](#tagging-pull-requests).
72+
Before pushing your changes to GitHub run `make check-before-commit`, this will remove trailing spaces, create new auto tests,
73+
test entire package and build the documentation.
74+
If you get no errors, you're ready to submit your changes!
6875

69-
A member of the development team will review your changes to confirm that they can be merged into the main codebase.
76+
**4. Submit a [pull request][link_pullrequest].**
7077

71-
## Tagging Pull Requests
78+
A new pull request for your changes should be created from your GitHub account.
7279

73-
Pull requests should be submitted early and often! When opening a pull request, please use one of the following prefixes:
80+
When opening a pull request, please use one of the following prefixes:
7481

7582

7683
* **[ENH]** for enhancements
@@ -81,11 +88,14 @@ Pull requests should be submitted early and often! When opening a pull request,
8188
* **[REF]** for refactoring existing code
8289

8390
<br>
84-
85-
If, when you submit, your pull request is not yet ready to be merged, please also include the **[WIP]** prefix. This tells the development team that your pull request is a "work-in-progress", and that you plan to continue working on it.
91+
Pull requests should be submitted early and often (please don't mix too many unrelated changes within one PR)!
92+
If your pull request is not yet ready to be merged, please also include the **[WIP]** prefix (you can remove it once your PR is ready to be merged).
93+
This tells the development team that your pull request is a "work-in-progress", and that you plan to continue working on it.
8694

8795
Review and discussion on new code can begin well before the work is complete, and the more discussion the better!
88-
In the worst case scenario, if the development team decides to pursue a different path than you've outlined, they'll close the pull request. That's really not so bad! :smile:
96+
This provides the opportunity to check with the development team the path you've outlined.
97+
98+
One your PR is ready a member of the development team will review your changes to confirm that they can be merged into the main codebase.
8999

90100
## Notes for New Code
91101

@@ -98,8 +108,9 @@ Do not log this, as it creates redundant/confusing logs.
98108

99109
#### Testing
100110
New code should be tested, whenever feasible.
101-
Bug fixes should include regression tests, and any new behavior should at least get minimal exercise.
102-
If you're not sure what this means for your code, ask!
111+
Bug fixes should include an example that exposes the issue.
112+
Any new features should have tests that show at least a minimal example.
113+
If you're not sure what this means for your code, please ask in your pull request.
103114

104115
## Recognizing contributions
105116

doc/devel/testing_nipype.rst

Lines changed: 25 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,18 @@ After cloning::
2727

2828
cd nipype
2929
pip install -r requirements.txt
30-
python setup.py develop
31-
32-
or::
33-
34-
cd nipype
35-
pip install -r requirements.txt
36-
pip install -e .[tests]
37-
30+
pip install -e .[dev]
3831

3932

4033
Test implementation
4134
-------------------
4235

4336
Nipype testing framework is built upon `pytest <http://doc.pytest.org/en/latest/>`_.
44-
By the time these guidelines are written, Nipype implements 17638 tests.
4537

4638
After installation in developer mode, the tests can be run with the
47-
following simple command at the root folder of the project ::
48-
49-
make tests
39+
following command at the root folder of the project ::
5040

51-
If ``make`` is not installed in the system, it is possible to run the tests using::
52-
53-
py.test --doctest-modules --cov=nipype nipype
41+
pytest -v --doctest-modules nipype
5442

5543

5644
A successful test run should complete in 10-30 minutes and end with
@@ -75,69 +63,50 @@ where ``$pathtomatlabdir`` is the path to your matlab installation and
7563
``$platform`` is the directory referring to x86 or x64 installations
7664
(typically ``glnxa64`` on 64-bit installations).
7765

78-
Skip tests
66+
Skipped tests
7967
~~~~~~~~~~
8068

8169
Nipype will skip some tests depending on the currently available software and data
8270
dependencies. Installing software dependencies and downloading the necessary data
83-
will reduce the number of skip tests.
71+
will reduce the number of skipped tests.
8472

85-
Some tests in Nipype make use of some images distributed within the `FSL course data
73+
A few tests in Nipype make use of some images distributed within the `FSL course data
8674
<http://fsl.fmrib.ox.ac.uk/fslcourse/>`_. This reduced version of the package can be downloaded `here
8775
<https://files.osf.io/v1/resources/nefdp/providers/osfstorage/57f472cf9ad5a101f977ecfe>`_.
8876
To enable the tests depending on these data, just unpack the targz file and set the :code:`FSL_COURSE_DATA` environment
89-
variable to point to that folder.
77+
variable to point to that folder.
78+
Note, that the test execution time can increase significantly with these additional tests.
79+
9080

91-
Xfail tests
81+
Xfailed tests
9282
~~~~~~~~~~~
9383

9484
Some tests are expect to fail until the code will be changed or for other reasons.
9585

9686

97-
Avoiding any MATLAB calls from testing
98-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99-
100-
On unix systems, set an empty environment variable::
101-
102-
export NIPYPE_NO_MATLAB=
103-
104-
This will skip any tests that require matlab.
105-
106-
10787
Testing Nipype using Docker
10888
---------------------------
10989

110-
As of :code:`nipype-0.13`, Nipype is tested inside Docker containers. First, install the
111-
`Docker Engine <https://docs.docker.com/engine/installation/>`_.
112-
Nipype has one base docker image called nipype/base:latest, and several additional test images
113-
for various Python versions.
114-
115-
The base nipype image is built as follows::
90+
Nipype is tested inside Docker containers and users can use nipype images to test local versions.
91+
First, install the `Docker Engine <https://docs.docker.com/engine/installation/>`_.
92+
Nipype has one base docker image called nipype/base:latest, that contains several useful tools
93+
(FreeSurfer, AFNI, FSL, ANTs, etc.), and additional test images
94+
for specific Python versions: py27 for Python 2.7 and py36 for Python 3.6.
11695

117-
cd path/to/nipype/
118-
docker build -t nipype/base:latest -f docker/base.Dockerfile .
96+
Users can pull the nipype image for Python 3.6 as follows::
97+
98+
docker pull nipype/base:py36
11999

120-
This base image contains several useful tools (FreeSurfer, AFNI, FSL, ANTs, etc.),
121-
but not nipype.
100+
In order to test a local version of nipype you can run test within container as follows::
122101

123-
It is possible to fetch a built image from the latest master branch of nipype
124-
using::
102+
docker run -it -v $PWD:/src/nipype --rm nipype/nipype:py36 py.test -v --doctest-modules /src/nipype/nipype
125103

126-
docker run -it --rm nipype/nipype:master
127104

105+
Additional comments
106+
-------------------
128107

129-
The docker run command will then open the container and offer a bash shell for the
130-
developer.
131-
132-
For building a continer for running nipype in Python 3.6::
108+
If the project is tested both on your local OS and within a Docker container you might have to remove all
109+
``__pycache__`` directory before changing between system.
133110

134-
cd path/to/nipype/
135-
docker build -f Dockerfile -t nipype/nipype_test:py36 .
136-
docker run -it --rm -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" \
137-
-v ~/examples:/root/examples:ro \
138-
-v ~/scratch:/scratch \
139-
-w /root/src/nipype \
140-
nipype/nipype_test:py36 /usr/bin/run_pytests.sh
141111

142-
The last examples assume that the example data is downladed into ~/examples and
143-
the ~/scratch folder will be created if it does not exist previously.
112+

0 commit comments

Comments
 (0)